From c1d6a0ac450b875e36ca542a5e27e887f4aa1651 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 24 Aug 2022 05:51:04 +0000 Subject: [PATCH] CodeGen from PR 20354 in Azure/azure-rest-api-specs Update recoveryservicesbackup readme.python.md (#20354) Co-authored-by: Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) --- .../_meta.json | 10 +- .../activestamp/__init__.py | 16 +- .../activestamp/_configuration.py | 46 +- .../activestamp/_patch.py | 14 +- .../_recovery_services_backup_client.py | 217 +- .../activestamp/_serialization.py | 1970 +++ .../activestamp/_vendor.py | 26 +- .../activestamp/_version.py | 2 +- .../activestamp/aio/__init__.py | 16 +- .../activestamp/aio/_configuration.py | 48 +- .../activestamp/aio/_patch.py | 3 + .../aio/_recovery_services_backup_client.py | 217 +- .../activestamp/aio/_vendor.py | 28 + .../activestamp/aio/operations/__init__.py | 108 +- .../operations/_backup_engines_operations.py | 155 +- .../aio/operations/_backup_jobs_operations.py | 107 +- .../_backup_operation_results_operations.py | 89 +- .../_backup_operation_statuses_operations.py | 93 +- .../operations/_backup_policies_operations.py | 112 +- .../_backup_protectable_items_operations.py | 109 +- .../_backup_protected_items_operations.py | 107 +- ...backup_protection_containers_operations.py | 112 +- .../_backup_protection_intent_operations.py | 107 +- ..._resource_encryption_configs_operations.py | 206 +- ...urce_storage_configs_non_crr_operations.py | 326 +- ...ackup_resource_vault_configs_operations.py | 330 +- .../operations/_backup_status_operations.py | 150 +- .../_backup_usage_summaries_operations.py | 107 +- .../_backup_workload_items_operations.py | 115 +- .../aio/operations/_backups_operations.py | 187 +- ...e_data_move_operation_result_operations.py | 93 +- ...xport_jobs_operation_results_operations.py | 95 +- .../operations/_feature_support_operations.py | 152 +- ...m_level_recovery_connections_operations.py | 251 +- .../_job_cancellations_operations.py | 89 +- .../aio/operations/_job_details_operations.py | 93 +- .../_job_operation_results_operations.py | 91 +- .../aio/operations/_jobs_operations.py | 87 +- .../aio/operations/_operation_operations.py | 164 +- .../activestamp/aio/operations/_operations.py | 99 +- .../activestamp/aio/operations/_patch.py | 20 + ..._private_endpoint_connection_operations.py | 398 +- .../_private_endpoint_operations.py | 89 +- .../_protectable_containers_operations.py | 118 +- ...ected_item_operation_results_operations.py | 93 +- ...cted_item_operation_statuses_operations.py | 92 +- .../operations/_protected_items_operations.py | 295 +- ..._container_operation_results_operations.py | 91 +- ...er_refresh_operation_results_operations.py | 92 +- .../_protection_containers_operations.py | 398 +- .../_protection_intent_operations.py | 417 +- .../_protection_policies_operations.py | 329 +- ...ion_policy_operation_results_operations.py | 96 +- ...on_policy_operation_statuses_operations.py | 96 +- .../operations/_recovery_points_operations.py | 167 +- ..._points_recommended_for_move_operations.py | 141 +- ...overy_services_backup_client_operations.py | 635 +- .../_resource_guard_proxies_operations.py | 110 +- .../_resource_guard_proxy_operations.py | 406 +- .../aio/operations/_restores_operations.py | 254 +- .../operations/_security_pins_operations.py | 165 +- .../_validate_operation_operations.py | 220 +- .../_validate_operation_results_operations.py | 93 +- ..._validate_operation_statuses_operations.py | 92 +- .../activestamp/models/__init__.py | 862 +- .../activestamp/models/_models_py3.py | 11890 +++++++++------- .../activestamp/models/_patch.py | 20 + .../_recovery_services_backup_client_enums.py | 428 +- .../activestamp/operations/__init__.py | 108 +- .../operations/_backup_engines_operations.py | 246 +- .../operations/_backup_jobs_operations.py | 158 +- .../_backup_operation_results_operations.py | 142 +- .../_backup_operation_statuses_operations.py | 146 +- .../operations/_backup_policies_operations.py | 168 +- .../_backup_protectable_items_operations.py | 160 +- .../_backup_protected_items_operations.py | 158 +- ...backup_protection_containers_operations.py | 168 +- .../_backup_protection_intent_operations.py | 158 +- ..._resource_encryption_configs_operations.py | 315 +- ...urce_storage_configs_non_crr_operations.py | 485 +- ...ackup_resource_vault_configs_operations.py | 489 +- .../operations/_backup_status_operations.py | 211 +- .../_backup_usage_summaries_operations.py | 158 +- .../_backup_workload_items_operations.py | 172 +- .../operations/_backups_operations.py | 248 +- ...e_data_move_operation_result_operations.py | 146 +- ...xport_jobs_operation_results_operations.py | 148 +- .../operations/_feature_support_operations.py | 213 +- ...m_level_recovery_connections_operations.py | 360 +- .../_job_cancellations_operations.py | 142 +- .../operations/_job_details_operations.py | 146 +- .../_job_operation_results_operations.py | 147 +- .../operations/_jobs_operations.py | 141 +- .../operations/_operation_operations.py | 224 +- .../activestamp/operations/_operations.py | 139 +- .../activestamp/operations/_patch.py | 20 + ..._private_endpoint_connection_operations.py | 533 +- .../_private_endpoint_operations.py | 142 +- .../_protectable_containers_operations.py | 171 +- ...ected_item_operation_results_operations.py | 148 +- ...cted_item_operation_statuses_operations.py | 147 +- .../operations/_protected_items_operations.py | 434 +- ..._container_operation_results_operations.py | 144 +- ...er_refresh_operation_results_operations.py | 148 +- .../_protection_containers_operations.py | 605 +- .../_protection_intent_operations.py | 584 +- .../_protection_policies_operations.py | 474 +- ...ion_policy_operation_results_operations.py | 152 +- ...on_policy_operation_statuses_operations.py | 152 +- .../operations/_recovery_points_operations.py | 266 +- ..._points_recommended_for_move_operations.py | 206 +- ...overy_services_backup_client_operations.py | 823 +- .../_resource_guard_proxies_operations.py | 164 +- .../_resource_guard_proxy_operations.py | 591 +- .../operations/_restores_operations.py | 319 +- .../operations/_security_pins_operations.py | 229 +- .../_validate_operation_operations.py | 280 +- .../_validate_operation_results_operations.py | 146 +- ..._validate_operation_statuses_operations.py | 145 +- .../passivestamp/__init__.py | 16 +- .../passivestamp/_configuration.py | 42 +- .../passivestamp/_patch.py | 18 +- ...recovery_services_backup_passive_client.py | 71 +- .../passivestamp/_serialization.py | 1970 +++ .../passivestamp/_vendor.py | 6 +- .../passivestamp/_version.py | 2 +- .../passivestamp/aio/__init__.py | 16 +- .../passivestamp/aio/_configuration.py | 44 +- .../passivestamp/aio/_patch.py | 7 +- ...recovery_services_backup_passive_client.py | 71 +- .../passivestamp/aio/operations/__init__.py | 28 +- .../operations/_aad_properties_operations.py | 87 +- .../_backup_crr_job_details_operations.py | 147 +- .../operations/_backup_crr_jobs_operations.py | 132 +- .../_backup_protected_items_crr_operations.py | 106 +- ...kup_resource_storage_configs_operations.py | 325 +- .../_backup_usage_summaries_crr_operations.py | 106 +- .../_cross_region_restore_operations.py | 220 +- .../_crr_operation_results_operations.py | 85 +- .../_crr_operation_status_operations.py | 89 +- .../passivestamp/aio/operations/_patch.py | 20 + .../_recovery_points_crr_operations.py | 116 +- .../operations/_recovery_points_operations.py | 199 +- .../passivestamp/models/__init__.py | 370 +- .../passivestamp/models/_models_py3.py | 5043 ++++--- .../passivestamp/models/_patch.py | 20 + ...ry_services_backup_passive_client_enums.py | 172 +- .../passivestamp/operations/__init__.py | 28 +- .../operations/_aad_properties_operations.py | 137 +- .../_backup_crr_job_details_operations.py | 207 +- .../operations/_backup_crr_jobs_operations.py | 189 +- .../_backup_protected_items_crr_operations.py | 156 +- ...kup_resource_storage_configs_operations.py | 483 +- .../_backup_usage_summaries_crr_operations.py | 156 +- .../_cross_region_restore_operations.py | 275 +- .../_crr_operation_results_operations.py | 136 +- .../_crr_operation_status_operations.py | 140 +- .../passivestamp/operations/_patch.py | 20 + .../_recovery_points_crr_operations.py | 172 +- .../operations/_recovery_points_operations.py | 261 +- 160 files changed, 29680 insertions(+), 19181 deletions(-) create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_patch.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_patch.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_patch.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_patch.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_patch.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_patch.py diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json index 16140a9b0c669..d54bcd4ac1a66 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.7.2", + "autorest": "3.8.4", "use": [ - "@autorest/python@5.13.0", - "@autorest/modelerfour@4.19.3" + "@autorest/python@6.0.1", + "@autorest/modelerfour@4.23.5" ], - "commit": "7145001d2fffdcfe811c66baf9fef359c3180669", + "commit": "8c6f54ef868240d16aebb269abf56b9a1adf7ecc", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", "readme": "specification/recoveryservicesbackup/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py index a44ce6ced1557..15cfc033acec5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py @@ -10,9 +10,15 @@ from ._version import VERSION __version__ = VERSION -__all__ = ['RecoveryServicesBackupClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["RecoveryServicesBackupClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py index 04b7205f9e077..6580b62870a58 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py @@ -25,23 +25,18 @@ class RecoveryServicesBackupClientConfiguration(Configuration): # pylint: disab 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. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", "2022-06-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicesbackup/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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') + 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_patch.py index 56184987595f0..41fd81d5f41ec 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_patch.py @@ -33,6 +33,7 @@ if TYPE_CHECKING: from azure.core.credentials import TokenCredential + class RemoveDuplicateParamsPolicy(SansIOHTTPPolicy): def __init__(self, duplicate_param_names): # type: (List[str]) -> None @@ -41,17 +42,19 @@ def __init__(self, duplicate_param_names): def on_request(self, request): parsed_url = urllib.parse.urlparse(request.http_request.url) query_params = urllib.parse.parse_qs(parsed_url.query) - filtered_query_params = { - k: v[-1:] if k in self.duplicate_param_names else v - for k, v in query_params.items() - } - request.http_request.url = request.http_request.url.replace(parsed_url.query, "") + urllib.parse.urlencode(filtered_query_params, doseq=True) + filtered_query_params = {k: v[-1:] if k in self.duplicate_param_names else v for k, v in query_params.items()} + request.http_request.url = request.http_request.url.replace(parsed_url.query, "") + urllib.parse.urlencode( + filtered_query_params, doseq=True + ) return super().on_request(request) + DUPLICATE_PARAMS_POLICY = RemoveDuplicateParamsPolicy(duplicate_param_names=["$filter", "$skiptoken", "api-version"]) + class RecoveryServicesBackupClient(RecoveryServicesBackupClientGenerated): __doc__ = RecoveryServicesBackupClientGenerated.__doc__ + def __init__( self, credential: "TokenCredential", @@ -72,6 +75,7 @@ def __init__( **kwargs ) + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py index c1a3d610ea482..e7fc30f17e53f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py @@ -9,20 +9,72 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models from ._configuration import RecoveryServicesBackupClientConfiguration -from .operations import BMSPrepareDataMoveOperationResultOperations, BackupEnginesOperations, BackupJobsOperations, BackupOperationResultsOperations, BackupOperationStatusesOperations, BackupPoliciesOperations, BackupProtectableItemsOperations, BackupProtectedItemsOperations, BackupProtectionContainersOperations, BackupProtectionIntentOperations, BackupResourceEncryptionConfigsOperations, BackupResourceStorageConfigsNonCRROperations, BackupResourceVaultConfigsOperations, BackupStatusOperations, BackupUsageSummariesOperations, BackupWorkloadItemsOperations, BackupsOperations, ExportJobsOperationResultsOperations, FeatureSupportOperations, ItemLevelRecoveryConnectionsOperations, JobCancellationsOperations, JobDetailsOperations, JobOperationResultsOperations, JobsOperations, OperationOperations, Operations, PrivateEndpointConnectionOperations, PrivateEndpointOperations, ProtectableContainersOperations, ProtectedItemOperationResultsOperations, ProtectedItemOperationStatusesOperations, ProtectedItemsOperations, ProtectionContainerOperationResultsOperations, ProtectionContainerRefreshOperationResultsOperations, ProtectionContainersOperations, ProtectionIntentOperations, ProtectionPoliciesOperations, ProtectionPolicyOperationResultsOperations, ProtectionPolicyOperationStatusesOperations, RecoveryPointsOperations, RecoveryPointsRecommendedForMoveOperations, RecoveryServicesBackupClientOperationsMixin, ResourceGuardProxiesOperations, ResourceGuardProxyOperations, RestoresOperations, SecurityPINsOperations, ValidateOperationOperations, ValidateOperationResultsOperations, ValidateOperationStatusesOperations +from ._serialization import Deserializer, Serializer +from .operations import ( + BMSPrepareDataMoveOperationResultOperations, + BackupEnginesOperations, + BackupJobsOperations, + BackupOperationResultsOperations, + BackupOperationStatusesOperations, + BackupPoliciesOperations, + BackupProtectableItemsOperations, + BackupProtectedItemsOperations, + BackupProtectionContainersOperations, + BackupProtectionIntentOperations, + BackupResourceEncryptionConfigsOperations, + BackupResourceStorageConfigsNonCRROperations, + BackupResourceVaultConfigsOperations, + BackupStatusOperations, + BackupUsageSummariesOperations, + BackupWorkloadItemsOperations, + BackupsOperations, + ExportJobsOperationResultsOperations, + FeatureSupportOperations, + ItemLevelRecoveryConnectionsOperations, + JobCancellationsOperations, + JobDetailsOperations, + JobOperationResultsOperations, + JobsOperations, + OperationOperations, + Operations, + PrivateEndpointConnectionOperations, + PrivateEndpointOperations, + ProtectableContainersOperations, + ProtectedItemOperationResultsOperations, + ProtectedItemOperationStatusesOperations, + ProtectedItemsOperations, + ProtectionContainerOperationResultsOperations, + ProtectionContainerRefreshOperationResultsOperations, + ProtectionContainersOperations, + ProtectionIntentOperations, + ProtectionPoliciesOperations, + ProtectionPolicyOperationResultsOperations, + ProtectionPolicyOperationStatusesOperations, + RecoveryPointsOperations, + RecoveryPointsRecommendedForMoveOperations, + RecoveryServicesBackupClientOperationsMixin, + ResourceGuardProxiesOperations, + ResourceGuardProxyOperations, + RestoresOperations, + SecurityPINsOperations, + ValidateOperationOperations, + ValidateOperationResultsOperations, + ValidateOperationStatusesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): # pylint: disable=too-many-instance-attributes + +class RecoveryServicesBackupClient( + RecoveryServicesBackupClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations @@ -172,14 +224,14 @@ class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): :ivar resource_guard_proxy: ResourceGuardProxyOperations operations :vartype resource_guard_proxy: azure.mgmt.recoveryservicesbackup.activestamp.operations.ResourceGuardProxyOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -192,68 +244,133 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = RecoveryServicesBackupClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = RecoveryServicesBackupClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.backup_resource_storage_configs_non_crr = BackupResourceStorageConfigsNonCRROperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_intent = ProtectionIntentOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_resource_storage_configs_non_crr = BackupResourceStorageConfigsNonCRROperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_intent = ProtectionIntentOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_status = BackupStatusOperations(self._client, self._config, self._serialize, self._deserialize) self.feature_support = FeatureSupportOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protection_intent = BackupProtectionIntentOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_usage_summaries = BackupUsageSummariesOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_protection_intent = BackupProtectionIntentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_usage_summaries = BackupUsageSummariesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.backup_resource_vault_configs = BackupResourceVaultConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_resource_encryption_configs = BackupResourceEncryptionConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connection = PrivateEndpointConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint = PrivateEndpointOperations(self._client, self._config, self._serialize, self._deserialize) - self.bms_prepare_data_move_operation_result = BMSPrepareDataMoveOperationResultOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_resource_vault_configs = BackupResourceVaultConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_resource_encryption_configs = BackupResourceEncryptionConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection = PrivateEndpointConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint = PrivateEndpointOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bms_prepare_data_move_operation_result = BMSPrepareDataMoveOperationResultOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.protected_items = ProtectedItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protected_item_operation_results = ProtectedItemOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protected_item_operation_results = ProtectedItemOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) self.restores = RestoresOperations(self._client, self._config, self._serialize, self._deserialize) self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_policies = ProtectionPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_policy_operation_results = ProtectionPolicyOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protection_policies = ProtectionPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_policy_operation_results = ProtectionPolicyOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_jobs = BackupJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.job_details = JobDetailsOperations(self._client, self._config, self._serialize, self._deserialize) - self.job_cancellations = JobCancellationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.job_operation_results = JobOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.export_jobs_operation_results = ExportJobsOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.job_cancellations = JobCancellationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.job_operation_results = JobOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.export_jobs_operation_results = ExportJobsOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protected_items = BackupProtectedItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_protected_items = BackupProtectedItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate_operation = ValidateOperationOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate_operation_results = ValidateOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate_operation_statuses = ValidateOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.validate_operation = ValidateOperationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.validate_operation_results = ValidateOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.validate_operation_statuses = ValidateOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_engines = BackupEnginesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_container_refresh_operation_results = ProtectionContainerRefreshOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protectable_containers = ProtectableContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_containers = ProtectionContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_workload_items = BackupWorkloadItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_container_operation_results = ProtectionContainerOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protection_container_refresh_operation_results = ProtectionContainerRefreshOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protectable_containers = ProtectableContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_containers = ProtectionContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_workload_items = BackupWorkloadItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_container_operation_results = ProtectionContainerOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protected_item_operation_statuses = ProtectedItemOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) - self.item_level_recovery_connections = ItemLevelRecoveryConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_operation_results = BackupOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_operation_statuses = BackupOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_policy_operation_statuses = ProtectionPolicyOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protectable_items = BackupProtectableItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protection_containers = BackupProtectionContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.protected_item_operation_statuses = ProtectedItemOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.item_level_recovery_connections = ItemLevelRecoveryConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_operation_results = BackupOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_operation_statuses = BackupOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_policy_operation_statuses = ProtectionPolicyOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_protectable_items = BackupProtectableItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_protection_containers = BackupProtectionContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.security_pins = SecurityPINsOperations(self._client, self._config, self._serialize, self._deserialize) - self.recovery_points_recommended_for_move = RecoveryPointsRecommendedForMoveOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_guard_proxies = ResourceGuardProxiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_guard_proxy = ResourceGuardProxyOperations(self._client, self._config, self._serialize, self._deserialize) - + self.recovery_points_recommended_for_move = RecoveryPointsRecommendedForMoveOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resource_guard_proxies = ResourceGuardProxiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resource_guard_proxy = ResourceGuardProxyOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -262,7 +379,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py new file mode 100644 index 0000000000000..648f84cc4e653 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py @@ -0,0 +1,1970 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes=None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes=None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py index 138f663c53a4e..378b64967444e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py @@ -5,8 +5,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import RecoveryServicesBackupClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +26,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +34,14 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: RecoveryServicesBackupClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py index 34ea7990c4b4a..e5754a47ce68f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py index 468a2bb9e3e43..cff2a6c66af2f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._recovery_services_backup_client import RecoveryServicesBackupClient -__all__ = ['RecoveryServicesBackupClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["RecoveryServicesBackupClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py index a57f34b0f26de..d24993e30b9a3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py @@ -25,23 +25,18 @@ class RecoveryServicesBackupClientConfiguration(Configuration): # pylint: disab 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. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", "2022-06-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicesbackup/{}".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') + 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_patch.py index eea0326b9de6e..dd553ed785bda 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_patch.py @@ -32,8 +32,10 @@ if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential + class RecoveryServicesBackupClient(RecoveryServicesBackupClientGenerated): __doc__ = RecoveryServicesBackupClientGenerated.__doc__ + def __init__( self, credential: "AsyncTokenCredential", @@ -54,6 +56,7 @@ def __init__( **kwargs ) + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py index 81a7c2705e774..33bc1b69ad3f9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py @@ -9,20 +9,72 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from .._serialization import Deserializer, Serializer from ._configuration import RecoveryServicesBackupClientConfiguration -from .operations import BMSPrepareDataMoveOperationResultOperations, BackupEnginesOperations, BackupJobsOperations, BackupOperationResultsOperations, BackupOperationStatusesOperations, BackupPoliciesOperations, BackupProtectableItemsOperations, BackupProtectedItemsOperations, BackupProtectionContainersOperations, BackupProtectionIntentOperations, BackupResourceEncryptionConfigsOperations, BackupResourceStorageConfigsNonCRROperations, BackupResourceVaultConfigsOperations, BackupStatusOperations, BackupUsageSummariesOperations, BackupWorkloadItemsOperations, BackupsOperations, ExportJobsOperationResultsOperations, FeatureSupportOperations, ItemLevelRecoveryConnectionsOperations, JobCancellationsOperations, JobDetailsOperations, JobOperationResultsOperations, JobsOperations, OperationOperations, Operations, PrivateEndpointConnectionOperations, PrivateEndpointOperations, ProtectableContainersOperations, ProtectedItemOperationResultsOperations, ProtectedItemOperationStatusesOperations, ProtectedItemsOperations, ProtectionContainerOperationResultsOperations, ProtectionContainerRefreshOperationResultsOperations, ProtectionContainersOperations, ProtectionIntentOperations, ProtectionPoliciesOperations, ProtectionPolicyOperationResultsOperations, ProtectionPolicyOperationStatusesOperations, RecoveryPointsOperations, RecoveryPointsRecommendedForMoveOperations, RecoveryServicesBackupClientOperationsMixin, ResourceGuardProxiesOperations, ResourceGuardProxyOperations, RestoresOperations, SecurityPINsOperations, ValidateOperationOperations, ValidateOperationResultsOperations, ValidateOperationStatusesOperations +from .operations import ( + BMSPrepareDataMoveOperationResultOperations, + BackupEnginesOperations, + BackupJobsOperations, + BackupOperationResultsOperations, + BackupOperationStatusesOperations, + BackupPoliciesOperations, + BackupProtectableItemsOperations, + BackupProtectedItemsOperations, + BackupProtectionContainersOperations, + BackupProtectionIntentOperations, + BackupResourceEncryptionConfigsOperations, + BackupResourceStorageConfigsNonCRROperations, + BackupResourceVaultConfigsOperations, + BackupStatusOperations, + BackupUsageSummariesOperations, + BackupWorkloadItemsOperations, + BackupsOperations, + ExportJobsOperationResultsOperations, + FeatureSupportOperations, + ItemLevelRecoveryConnectionsOperations, + JobCancellationsOperations, + JobDetailsOperations, + JobOperationResultsOperations, + JobsOperations, + OperationOperations, + Operations, + PrivateEndpointConnectionOperations, + PrivateEndpointOperations, + ProtectableContainersOperations, + ProtectedItemOperationResultsOperations, + ProtectedItemOperationStatusesOperations, + ProtectedItemsOperations, + ProtectionContainerOperationResultsOperations, + ProtectionContainerRefreshOperationResultsOperations, + ProtectionContainersOperations, + ProtectionIntentOperations, + ProtectionPoliciesOperations, + ProtectionPolicyOperationResultsOperations, + ProtectionPolicyOperationStatusesOperations, + RecoveryPointsOperations, + RecoveryPointsRecommendedForMoveOperations, + RecoveryServicesBackupClientOperationsMixin, + ResourceGuardProxiesOperations, + ResourceGuardProxyOperations, + RestoresOperations, + SecurityPINsOperations, + ValidateOperationOperations, + ValidateOperationResultsOperations, + ValidateOperationStatusesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): # pylint: disable=too-many-instance-attributes + +class RecoveryServicesBackupClient( + RecoveryServicesBackupClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations @@ -174,14 +226,14 @@ class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): :ivar resource_guard_proxy: ResourceGuardProxyOperations operations :vartype resource_guard_proxy: azure.mgmt.recoveryservicesbackup.activestamp.aio.operations.ResourceGuardProxyOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -194,68 +246,133 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = RecoveryServicesBackupClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = RecoveryServicesBackupClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.backup_resource_storage_configs_non_crr = BackupResourceStorageConfigsNonCRROperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_intent = ProtectionIntentOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_resource_storage_configs_non_crr = BackupResourceStorageConfigsNonCRROperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_intent = ProtectionIntentOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_status = BackupStatusOperations(self._client, self._config, self._serialize, self._deserialize) self.feature_support = FeatureSupportOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protection_intent = BackupProtectionIntentOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_usage_summaries = BackupUsageSummariesOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_protection_intent = BackupProtectionIntentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_usage_summaries = BackupUsageSummariesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.backup_resource_vault_configs = BackupResourceVaultConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_resource_encryption_configs = BackupResourceEncryptionConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connection = PrivateEndpointConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint = PrivateEndpointOperations(self._client, self._config, self._serialize, self._deserialize) - self.bms_prepare_data_move_operation_result = BMSPrepareDataMoveOperationResultOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_resource_vault_configs = BackupResourceVaultConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_resource_encryption_configs = BackupResourceEncryptionConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connection = PrivateEndpointConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint = PrivateEndpointOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bms_prepare_data_move_operation_result = BMSPrepareDataMoveOperationResultOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.protected_items = ProtectedItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protected_item_operation_results = ProtectedItemOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protected_item_operation_results = ProtectedItemOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) self.restores = RestoresOperations(self._client, self._config, self._serialize, self._deserialize) self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_policies = ProtectionPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_policy_operation_results = ProtectionPolicyOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protection_policies = ProtectionPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_policy_operation_results = ProtectionPolicyOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_jobs = BackupJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.job_details = JobDetailsOperations(self._client, self._config, self._serialize, self._deserialize) - self.job_cancellations = JobCancellationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.job_operation_results = JobOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.export_jobs_operation_results = ExportJobsOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.job_cancellations = JobCancellationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.job_operation_results = JobOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.export_jobs_operation_results = ExportJobsOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protected_items = BackupProtectedItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_protected_items = BackupProtectedItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate_operation = ValidateOperationOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate_operation_results = ValidateOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.validate_operation_statuses = ValidateOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) + self.validate_operation = ValidateOperationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.validate_operation_results = ValidateOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.validate_operation_statuses = ValidateOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_engines = BackupEnginesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_container_refresh_operation_results = ProtectionContainerRefreshOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protectable_containers = ProtectableContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_containers = ProtectionContainersOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_workload_items = BackupWorkloadItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_container_operation_results = ProtectionContainerOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.protection_container_refresh_operation_results = ProtectionContainerRefreshOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protectable_containers = ProtectableContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_containers = ProtectionContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_workload_items = BackupWorkloadItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_container_operation_results = ProtectionContainerOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.protected_item_operation_statuses = ProtectedItemOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) - self.item_level_recovery_connections = ItemLevelRecoveryConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_operation_results = BackupOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_operation_statuses = BackupOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) - self.protection_policy_operation_statuses = ProtectionPolicyOperationStatusesOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protectable_items = BackupProtectableItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protection_containers = BackupProtectionContainersOperations(self._client, self._config, self._serialize, self._deserialize) + self.protected_item_operation_statuses = ProtectedItemOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.item_level_recovery_connections = ItemLevelRecoveryConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_operation_results = BackupOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_operation_statuses = BackupOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.protection_policy_operation_statuses = ProtectionPolicyOperationStatusesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_protectable_items = BackupProtectableItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_protection_containers = BackupProtectionContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.security_pins = SecurityPINsOperations(self._client, self._config, self._serialize, self._deserialize) - self.recovery_points_recommended_for_move = RecoveryPointsRecommendedForMoveOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_guard_proxies = ResourceGuardProxiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resource_guard_proxy = ResourceGuardProxyOperations(self._client, self._config, self._serialize, self._deserialize) - + self.recovery_points_recommended_for_move = RecoveryPointsRecommendedForMoveOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resource_guard_proxies = ResourceGuardProxiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resource_guard_proxy = ResourceGuardProxyOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -264,7 +381,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py new file mode 100644 index 0000000000000..f398622a7581a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# 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 abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import RecoveryServicesBackupClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: RecoveryServicesBackupClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py index 262a069be4dce..b99ca58fa0746 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py @@ -38,7 +38,9 @@ from ._validate_operation_results_operations import ValidateOperationResultsOperations from ._validate_operation_statuses_operations import ValidateOperationStatusesOperations from ._backup_engines_operations import BackupEnginesOperations -from ._protection_container_refresh_operation_results_operations import ProtectionContainerRefreshOperationResultsOperations +from ._protection_container_refresh_operation_results_operations import ( + ProtectionContainerRefreshOperationResultsOperations, +) from ._protectable_containers_operations import ProtectableContainersOperations from ._protection_containers_operations import ProtectionContainersOperations from ._backup_workload_items_operations import BackupWorkloadItemsOperations @@ -56,54 +58,60 @@ from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations from ._resource_guard_proxy_operations import ResourceGuardProxyOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'BackupResourceStorageConfigsNonCRROperations', - 'ProtectionIntentOperations', - 'BackupStatusOperations', - 'FeatureSupportOperations', - 'BackupProtectionIntentOperations', - 'BackupUsageSummariesOperations', - 'Operations', - 'BackupResourceVaultConfigsOperations', - 'BackupResourceEncryptionConfigsOperations', - 'PrivateEndpointConnectionOperations', - 'PrivateEndpointOperations', - 'RecoveryServicesBackupClientOperationsMixin', - 'BMSPrepareDataMoveOperationResultOperations', - 'ProtectedItemsOperations', - 'ProtectedItemOperationResultsOperations', - 'RecoveryPointsOperations', - 'RestoresOperations', - 'BackupPoliciesOperations', - 'ProtectionPoliciesOperations', - 'ProtectionPolicyOperationResultsOperations', - 'BackupJobsOperations', - 'JobDetailsOperations', - 'JobCancellationsOperations', - 'JobOperationResultsOperations', - 'ExportJobsOperationResultsOperations', - 'JobsOperations', - 'BackupProtectedItemsOperations', - 'OperationOperations', - 'ValidateOperationOperations', - 'ValidateOperationResultsOperations', - 'ValidateOperationStatusesOperations', - 'BackupEnginesOperations', - 'ProtectionContainerRefreshOperationResultsOperations', - 'ProtectableContainersOperations', - 'ProtectionContainersOperations', - 'BackupWorkloadItemsOperations', - 'ProtectionContainerOperationResultsOperations', - 'BackupsOperations', - 'ProtectedItemOperationStatusesOperations', - 'ItemLevelRecoveryConnectionsOperations', - 'BackupOperationResultsOperations', - 'BackupOperationStatusesOperations', - 'ProtectionPolicyOperationStatusesOperations', - 'BackupProtectableItemsOperations', - 'BackupProtectionContainersOperations', - 'SecurityPINsOperations', - 'RecoveryPointsRecommendedForMoveOperations', - 'ResourceGuardProxiesOperations', - 'ResourceGuardProxyOperations', + "BackupResourceStorageConfigsNonCRROperations", + "ProtectionIntentOperations", + "BackupStatusOperations", + "FeatureSupportOperations", + "BackupProtectionIntentOperations", + "BackupUsageSummariesOperations", + "Operations", + "BackupResourceVaultConfigsOperations", + "BackupResourceEncryptionConfigsOperations", + "PrivateEndpointConnectionOperations", + "PrivateEndpointOperations", + "RecoveryServicesBackupClientOperationsMixin", + "BMSPrepareDataMoveOperationResultOperations", + "ProtectedItemsOperations", + "ProtectedItemOperationResultsOperations", + "RecoveryPointsOperations", + "RestoresOperations", + "BackupPoliciesOperations", + "ProtectionPoliciesOperations", + "ProtectionPolicyOperationResultsOperations", + "BackupJobsOperations", + "JobDetailsOperations", + "JobCancellationsOperations", + "JobOperationResultsOperations", + "ExportJobsOperationResultsOperations", + "JobsOperations", + "BackupProtectedItemsOperations", + "OperationOperations", + "ValidateOperationOperations", + "ValidateOperationResultsOperations", + "ValidateOperationStatusesOperations", + "BackupEnginesOperations", + "ProtectionContainerRefreshOperationResultsOperations", + "ProtectableContainersOperations", + "ProtectionContainersOperations", + "BackupWorkloadItemsOperations", + "ProtectionContainerOperationResultsOperations", + "BackupsOperations", + "ProtectedItemOperationStatusesOperations", + "ItemLevelRecoveryConnectionsOperations", + "BackupOperationResultsOperations", + "BackupOperationStatusesOperations", + "ProtectionPolicyOperationStatusesOperations", + "BackupProtectableItemsOperations", + "BackupProtectionContainersOperations", + "SecurityPINsOperations", + "RecoveryPointsRecommendedForMoveOperations", + "ResourceGuardProxiesOperations", + "ResourceGuardProxyOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py index a52bfa24cf9a6..200b9d270e33b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py @@ -7,43 +7,51 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_engines_operations import build_get_request, build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupEnginesOperations: - """BackupEnginesOperations 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. +class BackupEnginesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_engines` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -53,61 +61,60 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.BackupEngineBaseResourceList"]: + ) -> AsyncIterable["_models.BackupEngineBaseResource"]: """Backup management servers registered to Recovery Services Vault. Returns a pageable list of servers. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupEngineBaseResourceList or the result of + :return: An iterator like instance of either BackupEngineBaseResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupEngineBaseResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -121,10 +128,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,11 +139,9 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore @distributed_trace_async async def get( @@ -149,64 +152,64 @@ async def get( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> "_models.BackupEngineBaseResource": + ) -> _models.BackupEngineBaseResource: """Returns backup management server registered to Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param backup_engine_name: Name of the backup management server. + :param backup_engine_name: Name of the backup management server. Required. :type backup_engine_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupEngineBaseResource, or the result of cls(response) + :return: BackupEngineBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupEngineBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, backup_engine_name=backup_engine_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, skip_token=skip_token, - template_url=self.get.metadata['url'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupEngineBaseResource', pipeline_response) + deserialized = self._deserialize("BackupEngineBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py index b4966a26b1574..15a8ac58b65d6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py @@ -7,42 +7,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_jobs_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupJobsOperations: - """BackupJobsOperations 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. +class BackupJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,59 +60,58 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.JobResourceList"]: + ) -> AsyncIterable["_models.JobResource"]: """Provides a pageable list of jobs. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobResourceList or the result of cls(response) + :return: An iterator like instance of either JobResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -118,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,8 +136,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py index 8375ea5a0db81..639be0b87003b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py @@ -8,48 +8,51 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupOperationResultsOperations: - """BackupOperationResultsOperations 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. +class BackupOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any ) -> None: """Provides the status of the delete operations such as deleting backed up item. Once the operation has started, the @@ -59,43 +62,44 @@ async def get( # pylint: disable=inconsistent-return-statements argument. OperationID is part of the Location header of the operation response. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: OperationID which represents the operation. + :param operation_id: OperationID which represents the operation. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -105,5 +109,4 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py index 252ef0b7f2a56..bcba580077692 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py @@ -8,104 +8,107 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_operation_statuses_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupOperationStatusesOperations: - """BackupOperationStatusesOperations 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. +class BackupOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Fetches the status of an operation such as triggering a backup, restore. The status can be in progress, completed or failed. You can refer to the OperationStatus enum for all the possible states of an operation. Some operations create jobs. This method returns the list of jobs when the operation is complete. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: OperationID which represents the operation. + :param operation_id: OperationID which represents the operation. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py index 5d747a0244722..441fe5025a180 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py @@ -7,102 +7,106 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_policies_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +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. +class BackupPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, - vault_name: str, - resource_group_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectionPolicyResourceList"]: + self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ProtectionPolicyResource"]: """Lists of backup policies associated with Recovery Services Vault. API provides pagination parameters to fetch scoped results. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionPolicyResourceList or the result of + :return: An iterator like instance of either ProtectionPolicyResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -116,10 +120,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -129,8 +131,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py index 0e40ce91d2b28..e8f16fe0ef601 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py @@ -7,42 +7,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protectable_items_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupProtectableItemsOperations: - """BackupProtectableItemsOperations 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. +class BackupProtectableItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_protectable_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,62 +60,61 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadProtectableItemResourceList"]: + ) -> AsyncIterable["_models.WorkloadProtectableItemResource"]: """Provides a pageable list of protectable objects within your subscription according to the query filter and the pagination parameters. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadProtectableItemResourceList or the result - of cls(response) + :return: An iterator like instance of either WorkloadProtectableItemResource or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadProtectableItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadProtectableItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -121,10 +128,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -134,8 +139,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py index 0e74c564dbf28..7c95f0e3614eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py @@ -7,42 +7,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protected_items_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupProtectedItemsOperations: - """BackupProtectedItemsOperations 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. +class BackupProtectedItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_protected_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,60 +60,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ProtectedItemResourceList"]: + ) -> AsyncIterable["_models.ProtectedItemResource"]: """Provides a pageable list of all items that are backed up within a vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectedItemResourceList or the result of + :return: An iterator like instance of either ProtectedItemResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,10 +126,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,8 +137,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py index d9562ffce425f..6f9f8057c0438 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py @@ -7,100 +7,104 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protection_containers_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupProtectionContainersOperations: - """BackupProtectionContainersOperations 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. +class BackupProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_protection_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, - vault_name: str, - resource_group_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectionContainerResourceList"]: + self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ProtectionContainerResource"]: """Lists the containers registered to Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerResourceList or the result of + :return: An iterator like instance of either ProtectionContainerResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -114,10 +118,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -127,8 +129,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py index a6cc68a4c57be..1b43f2de651f5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py @@ -7,42 +7,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protection_intent_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupProtectionIntentOperations: - """BackupProtectionIntentOperations 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. +class BackupProtectionIntentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_protection_intent` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,60 +60,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ProtectionIntentResourceList"]: + ) -> AsyncIterable["_models.ProtectionIntentResource"]: """Provides a pageable list of all intents that are present within a vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionIntentResourceList or the result of + :return: An iterator like instance of either ProtectionIntentResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,10 +126,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,8 +137,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore + list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py index 2831946c2a439..ca31f1c8789f8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py @@ -6,87 +6,92 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_resource_encryption_configs_operations import build_get_request, build_update_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupResourceEncryptionConfigsOperations: - """BackupResourceEncryptionConfigsOperations 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. +class BackupResourceEncryptionConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_resource_encryption_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceEncryptionConfigExtendedResource": + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> _models.BackupResourceEncryptionConfigExtendedResource: """Fetches Vault Encryption config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceEncryptionConfigExtendedResource, or the result of cls(response) + :return: BackupResourceEncryptionConfigExtendedResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigExtendedResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceEncryptionConfigExtendedResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,49 +99,117 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceEncryptionConfigExtendedResource', pipeline_response) + deserialized = self._deserialize("BackupResourceEncryptionConfigExtendedResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + + @overload + async def update( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceEncryptionConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates Vault encryption config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault encryption input config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates Vault encryption config. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault encryption input config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceEncryptionConfigResource", + parameters: Union[_models.BackupResourceEncryptionConfigResource, IO], **kwargs: Any ) -> None: """Updates Vault encryption config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault encryption input config request. + :param parameters: Vault encryption input config request. Is either a model type or a IO type. + Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'BackupResourceEncryptionConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceEncryptionConfigResource") request = build_update_request( vault_name=vault_name, @@ -145,16 +218,18 @@ async def update( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -165,5 +240,4 @@ async def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py index 5b4dfdcee6fcc..acce218232487 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -6,86 +6,95 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._backup_resource_storage_configs_non_crr_operations import build_get_request, build_patch_request, build_update_request -T = TypeVar('T') +from ...operations._backup_resource_storage_configs_non_crr_operations import ( + build_get_request, + build_patch_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupResourceStorageConfigsNonCRROperations: - """BackupResourceStorageConfigsNonCRROperations 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. +class BackupResourceStorageConfigsNonCRROperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_resource_storage_configs_non_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> _models.BackupResourceConfigResource: """Fetches resource storage config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,49 +102,115 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + @overload + async def update( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + ) -> _models.BackupResourceConfigResource: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_update_request( vault_name=vault_name, @@ -144,16 +219,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,49 +238,115 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + + @overload + async def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any ) -> None: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_patch_request( vault_name=vault_name, @@ -212,16 +355,18 @@ async def patch( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.patch.metadata['url'], + content=_content, + template_url=self.patch.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -232,5 +377,4 @@ async def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore - + patch.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py index 4c2f947f4b5e3..5bc90b01ec8d9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py @@ -6,86 +6,95 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._backup_resource_vault_configs_operations import build_get_request, build_put_request, build_update_request -T = TypeVar('T') +from ...operations._backup_resource_vault_configs_operations import ( + build_get_request, + build_put_request, + build_update_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupResourceVaultConfigsOperations: - """BackupResourceVaultConfigsOperations 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. +class BackupResourceVaultConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_resource_vault_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceVaultConfigResource": + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: """Fetches resource vault config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceVaultConfigResource, or the result of cls(response) + :return: BackupResourceVaultConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceVaultConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,49 +102,115 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceVaultConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + + @overload + async def update( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceVaultConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def update( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceVaultConfigResource", + parameters: Union[_models.BackupResourceVaultConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceVaultConfigResource": + ) -> _models.BackupResourceVaultConfigResource: """Updates vault security config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource config request. + :param parameters: resource config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceVaultConfigResource, or the result of cls(response) + :return: BackupResourceVaultConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceVaultConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] - _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceVaultConfigResource") request = build_update_request( vault_name=vault_name, @@ -144,16 +219,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,49 +238,115 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceVaultConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + @overload + async def put( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceVaultConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def put( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceVaultConfigResource", + parameters: Union[_models.BackupResourceVaultConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceVaultConfigResource": + ) -> _models.BackupResourceVaultConfigResource: """Updates vault security config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource config request. + :param parameters: resource config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceVaultConfigResource, or the result of cls(response) + :return: BackupResourceVaultConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceVaultConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] - _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceVaultConfigResource") request = build_put_request( vault_name=vault_name, @@ -212,16 +355,18 @@ async def put( api_version=api_version, content_type=content_type, json=_json, - template_url=self.put.metadata['url'], + content=_content, + template_url=self.put.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -229,12 +374,11 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceVaultConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore - + put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py index e7a7619e659d3..0d9d393496b1c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py @@ -6,73 +6,136 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_status_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupStatusOperations: - """BackupStatusOperations 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. +class BackupStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def get( self, azure_region: str, - parameters: "_models.BackupStatusRequest", + parameters: _models.BackupStatusRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.BackupStatusResponse": + ) -> _models.BackupStatusResponse: """Get the container backup status. Get the container backup status. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Container Backup Status Request. + :param parameters: Container Backup Status Request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.BackupStatusResponse: + """Get the container backup status. + + Get the container backup status. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Container Backup Status Request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupStatusResponse, or the result of cls(response) + :return: BackupStatusResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStatusResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @distributed_trace_async + async def get( + self, azure_region: str, parameters: Union[_models.BackupStatusRequest, IO], **kwargs: Any + ) -> _models.BackupStatusResponse: + """Get the container backup status. - _json = self._serialize.body(parameters, 'BackupStatusRequest') + Get the container backup status. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Container Backup Status Request. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStatusResponse] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupStatusRequest") request = build_get_request( azure_region=azure_region, @@ -80,28 +143,29 @@ async def get( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get.metadata['url'], + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStatusResponse', pipeline_response) + deserialized = self._deserialize("BackupStatusResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore - + get.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py index 506bb5148f0b7..9fca0a59e64f3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py @@ -7,42 +7,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_usage_summaries_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupUsageSummariesOperations: - """BackupUsageSummariesOperations 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. +class BackupUsageSummariesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_usage_summaries` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,60 +60,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.BackupManagementUsageList"]: + ) -> AsyncIterable["_models.BackupManagementUsage"]: """Fetches the backup management usage summaries of the vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupManagementUsageList or the result of + :return: An iterator like instance of either BackupManagementUsage or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsageList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,10 +126,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,8 +137,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py index 5db8c840ba5d9..2410a50b7e1d0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py @@ -7,42 +7,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_workload_items_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupWorkloadItemsOperations: - """BackupWorkloadItemsOperations 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. +class BackupWorkloadItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backup_workload_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -54,70 +62,67 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.WorkloadItemResourceList"]: + ) -> AsyncIterable["_models.WorkloadItemResource"]: """Provides a pageable list of workload item of a specific container according to the query filter and the pagination parameters. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container. + :param container_name: Name of the container. Required. :type container_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadItemResourceList or the result of + :return: An iterator like instance of either WorkloadItemResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -131,10 +136,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,8 +147,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py index 8a5b848d8c224..e8bcd987b381c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py @@ -6,42 +6,127 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backups_operations import build_trigger_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupsOperations: - """BackupsOperations 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. +class BackupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`backups` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def trigger( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: _models.BackupRequestResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers backup for specified backed up item. This is an asynchronous operation. To know the + status of the + operation, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Backup item for which backup needs to be triggered. Required. + :type protected_item_name: str + :param parameters: resource backup request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupRequestResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def trigger( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers backup for specified backed up item. This is an asynchronous operation. To know the + status of the + operation, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Backup item for which backup needs to be triggered. Required. + :type protected_item_name: str + :param parameters: resource backup request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def trigger( # pylint: disable=inconsistent-return-statements @@ -51,62 +136,75 @@ async def trigger( # pylint: disable=inconsistent-return-statements fabric_name: str, container_name: str, protected_item_name: str, - parameters: "_models.BackupRequestResource", + parameters: Union[_models.BackupRequestResource, IO], **kwargs: Any ) -> None: """Triggers backup for specified backed up item. This is an asynchronous operation. To know the status of the operation, call GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Backup item for which backup needs to be triggered. + :param protected_item_name: Backup item for which backup needs to be triggered. Required. :type protected_item_name: str - :param parameters: resource backup request. + :param parameters: resource backup request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupRequestResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'BackupRequestResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupRequestResource") request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.trigger.metadata['url'], + content=_content, + template_url=self.trigger.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -116,5 +214,4 @@ async def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore - + trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py index 46c1f73badaf9..6d7c969bcebc2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py @@ -8,90 +8,94 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._bms_prepare_data_move_operation_result_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BMSPrepareDataMoveOperationResultOperations: - """BMSPrepareDataMoveOperationResultOperations 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. +class BMSPrepareDataMoveOperationResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`bms_prepare_data_move_operation_result` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> Optional["_models.VaultStorageConfigOperationResultResponse"]: + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.VaultStorageConfigOperationResultResponse]: """Fetches Operation Result for Prepare Data Move. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultStorageConfigOperationResultResponse, or the result of cls(response) + :return: VaultStorageConfigOperationResultResponse or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.VaultStorageConfigOperationResultResponse or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VaultStorageConfigOperationResultResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -101,12 +105,11 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultStorageConfigOperationResultResponse', pipeline_response) + deserialized = self._deserialize("VaultStorageConfigOperationResultResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py index e3e3b3a8fd223..f0732b206b5be 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py @@ -8,91 +8,95 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._export_jobs_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ExportJobsOperationResultsOperations: - """ExportJobsOperationResultsOperations 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. +class ExportJobsOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`export_jobs_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationResultInfoBaseResource": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationResultInfoBaseResource: """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 vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: OperationID which represents the export job. + :param operation_id: OperationID which represents the export job. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResultInfoBaseResource, or the result of cls(response) + :return: OperationResultInfoBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationResultInfoBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultInfoBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultInfoBaseResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -100,15 +104,14 @@ async def get( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OperationResultInfoBaseResource', pipeline_response) + deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('OperationResultInfoBaseResource', pipeline_response) + deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py index e2ba970fd7a97..f958daf932b8a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py @@ -6,74 +6,139 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._feature_support_operations import build_validate_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class FeatureSupportOperations: - """FeatureSupportOperations 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. +class FeatureSupportOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`feature_support` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def validate( self, azure_region: str, - parameters: "_models.FeatureSupportRequest", + parameters: _models.FeatureSupportRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.AzureVMResourceFeatureSupportResponse": + ) -> _models.AzureVMResourceFeatureSupportResponse: """It will validate if given feature with resource properties is supported in service. It will validate if given feature with resource properties is supported in service. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Feature support request object. + :param parameters: Feature support request object. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.FeatureSupportRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AzureVMResourceFeatureSupportResponse, or the result of cls(response) + :return: AzureVMResourceFeatureSupportResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureVMResourceFeatureSupportResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + async def validate( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureVMResourceFeatureSupportResponse: + """It will validate if given feature with resource properties is supported in service. - _json = self._serialize.body(parameters, 'FeatureSupportRequest') + It will validate if given feature with resource properties is supported in service. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Feature support request object. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureVMResourceFeatureSupportResponse or the result of cls(response) + :rtype: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate( + self, azure_region: str, parameters: Union[_models.FeatureSupportRequest, IO], **kwargs: Any + ) -> _models.AzureVMResourceFeatureSupportResponse: + """It will validate if given feature with resource properties is supported in service. + + It will validate if given feature with resource properties is supported in service. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Feature support request object. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.FeatureSupportRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureVMResourceFeatureSupportResponse or the result of cls(response) + :rtype: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AzureVMResourceFeatureSupportResponse] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "FeatureSupportRequest") request = build_validate_request( azure_region=azure_region, @@ -81,28 +146,29 @@ async def validate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate.metadata['url'], + content=_content, + template_url=self.validate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AzureVMResourceFeatureSupportResponse', pipeline_response) + deserialized = self._deserialize("AzureVMResourceFeatureSupportResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore - + validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py index 615ec546cf7fb..bb40351ea70f5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py @@ -6,44 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._item_level_recovery_connections_operations import build_provision_request, build_revoke_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ItemLevelRecoveryConnectionsOperations: - """ItemLevelRecoveryConnectionsOperations 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. +class ItemLevelRecoveryConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`item_level_recovery_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def provision( # pylint: disable=inconsistent-return-statements self, vault_name: str, @@ -52,7 +59,9 @@ async def provision( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.ILRRequestResource", + parameters: _models.ILRRequestResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Provisions a script which invokes an iSCSI connection to the backup data. Executing this script @@ -61,60 +70,166 @@ async def provision( # pylint: disable=inconsistent-return-statements To know the status of provisioning, call GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up items. + :param fabric_name: Fabric name associated with the backed up items. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up items. + :param container_name: Container name associated with the backed up items. Required. :type container_name: str :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. :type protected_item_name: str :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection will be provisioned - for this backed up data. + for this backed up data. Required. :type recovery_point_id: str - :param parameters: resource ILR request. + :param parameters: resource ILR request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ILRRequestResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def provision( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Provisions a script which invokes an iSCSI connection to the backup data. Executing this script + opens a file + explorer displaying all the recoverable files and folders. This is an asynchronous operation. + To know the status of + provisioning, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection + will be provisioned + for this backed up data. Required. + :type recovery_point_id: str + :param parameters: resource ILR request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def provision( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: Union[_models.ILRRequestResource, IO], + **kwargs: Any + ) -> None: + """Provisions a script which invokes an iSCSI connection to the backup data. Executing this script + opens a file + explorer displaying all the recoverable files and folders. This is an asynchronous operation. + To know the status of + provisioning, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection + will be provisioned + for this backed up data. Required. + :type recovery_point_id: str + :param parameters: resource ILR request. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ILRRequestResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ILRRequestResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ILRRequestResource") request = build_provision_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.provision.metadata['url'], + content=_content, + template_url=self.provision.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -124,8 +239,7 @@ async def provision( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - provision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore - + provision.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore @distributed_trace_async async def revoke( # pylint: disable=inconsistent-return-statements @@ -142,54 +256,56 @@ async def revoke( # pylint: disable=inconsistent-return-statements a file explorer displaying all recoverable files and folders. This is an asynchronous operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up items. + :param fabric_name: Fabric name associated with the backed up items. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up items. + :param container_name: Container name associated with the backed up items. Required. :type container_name: str :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. :type protected_item_name: str :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection will be revoked for - this backed up data. + this backed up data. Required. :type recovery_point_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_revoke_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revoke.metadata['url'], + template_url=self.revoke.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -199,5 +315,4 @@ async def revoke( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revoke.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore - + revoke.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py index 9484ca10ef7da..da93afa9b398f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py @@ -8,89 +8,93 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._job_cancellations_operations import build_trigger_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class JobCancellationsOperations: - """JobCancellationsOperations 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. +class JobCancellationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`job_cancellations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def trigger( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - job_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, job_name: str, **kwargs: Any ) -> None: """Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param job_name: Name of the job to cancel. + :param job_name: Name of the job to cancel. Required. :type job_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, job_name=job_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.trigger.metadata['url'], + template_url=self.trigger.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -100,5 +104,4 @@ async def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore - + trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py index d88c51f3dd4c2..d2f171d83cdd5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py @@ -8,100 +8,101 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._job_details_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class JobDetailsOperations: - """JobDetailsOperations 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. +class JobDetailsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`job_details` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( - self, - vault_name: str, - resource_group_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.JobResource": + async def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.JobResource: """Gets extended information associated with the job. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param job_name: Name of the job whose details are to be fetched. + :param job_name: Name of the job whose details are to be fetched. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JobResource, or the result of cls(response) + :return: JobResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, job_name=job_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('JobResource', pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py index 6784961d30575..e0397bcaaf908 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py @@ -8,92 +8,96 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._job_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class JobOperationResultsOperations: - """JobOperationResultsOperations 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. +class JobOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`job_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - job_name: str, - operation_id: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, job_name: str, operation_id: str, **kwargs: Any ) -> None: """Fetches the result of any operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param job_name: Job name whose operation result has to be fetched. + :param job_name: Job name whose operation result has to be fetched. Required. :type job_name: str :param operation_id: OperationID which represents the operation whose result has to be fetched. + Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, job_name=job_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -103,5 +107,4 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py index a3d764797072c..461a84a290fc6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py @@ -8,88 +8,92 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._jobs_operations import build_export_request -T = TypeVar('T') +from .._vendor import MixinABC + +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. +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def export( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - filter: Optional[str] = None, - **kwargs: Any + self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> None: """Triggers export of jobs specified by filters and returns an OperationID to track. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_export_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.export.metadata['url'], + api_version=api_version, + template_url=self.export.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -99,5 +103,4 @@ async def export( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - export.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore - + export.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py index 154ea13c722c5..fcc16a94a8c2b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py @@ -6,76 +6,151 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_operations import build_validate_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class OperationOperations: - """OperationOperations 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. +class OperationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`operation` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def validate( self, vault_name: str, resource_group_name: str, - parameters: "_models.ValidateOperationRequest", + parameters: _models.ValidateOperationRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateOperationsResponse": + ) -> _models.ValidateOperationsResponse: """Validate operation for specified backed up item. This is a synchronous operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource validate operation request. + :param parameters: resource validate operation request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateOperationsResponse, or the result of cls(response) + :return: ValidateOperationsResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateOperationsResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + async def validate( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateOperationsResponse: + """Validate operation for specified backed up item. This is a synchronous operation. - _json = self._serialize.body(parameters, 'ValidateOperationRequest') + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateOperationsResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate( + self, + vault_name: str, + resource_group_name: str, + parameters: Union[_models.ValidateOperationRequest, IO], + **kwargs: Any + ) -> _models.ValidateOperationsResponse: + """Validate operation for specified backed up item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Is either a model type or a IO type. + Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateOperationsResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateOperationsResponse] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateOperationRequest") request = build_validate_request( vault_name=vault_name, @@ -84,28 +159,29 @@ async def validate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate.metadata['url'], + content=_content, + template_url=self.validate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateOperationsResponse', pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore - + validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py index 168bce83b75c0..6eb66224e60af 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py @@ -7,82 +7,91 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class Operations: - """Operations 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. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ClientDiscoveryResponse"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForSingleApi"]: """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 + :return: An iterator like instance of either ClientDiscoveryValueForSingleApi or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryResponse] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryValueForSingleApi] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientDiscoveryResponse] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -96,10 +105,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -109,8 +116,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.RecoveryServices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.RecoveryServices/operations"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py index a56e813c51eaf..45d8a7a76caa1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py @@ -6,92 +6,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._private_endpoint_connection_operations import build_delete_request_initial, build_get_request, build_put_request_initial -T = TypeVar('T') +from ...operations._private_endpoint_connection_operations import ( + build_delete_request, + build_get_request, + build_put_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class PrivateEndpointConnectionOperations: - """PrivateEndpointConnectionOperations 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. +class PrivateEndpointConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`private_endpoint_connection` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_models.PrivateEndpointConnectionResource": + self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionResource: """Get Private Endpoint Connection. This call is made by Backup Admin. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionResource, or the result of cls(response) + :return: PrivateEndpointConnectionResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,53 +107,61 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _put_initial( self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnectionResource", + parameters: Union[_models.PrivateEndpointConnectionResource, IO], **kwargs: Any - ) -> "_models.PrivateEndpointConnectionResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'PrivateEndpointConnectionResource') - - request = build_put_request_initial( + ) -> _models.PrivateEndpointConnectionResource: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnectionResource") + + request = build_put_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._put_initial.metadata['url'], + content=_content, + template_url=self._put_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -153,18 +169,98 @@ async def _put_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @overload + async def begin_put( + self, + vault_name: str, + resource_group_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnectionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Request body for operation. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_put( + self, + vault_name: str, + resource_group_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: + """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 PrivateEndpointConnectionResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def begin_put( @@ -172,21 +268,24 @@ async def begin_put( vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnectionResource", + parameters: Union[_models.PrivateEndpointConnectionResource, IO], **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnectionResource"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnectionResource]: """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Request body for operation. + :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -199,84 +298,84 @@ async def begin_put( the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._put_initial( + raw_result = await self._put_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, private_endpoint_connection_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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,25 +385,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + async def begin_delete( + self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Delete Private Endpoint requests. This call is made by Backup Admin. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_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. @@ -316,42 +410,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._delete_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py index 13e5f2a9fa306..627b7bc2ceee7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py @@ -8,40 +8,47 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._private_endpoint_operations import build_get_operation_status_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class PrivateEndpointOperations: - """PrivateEndpointOperations 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. +class PrivateEndpointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`private_endpoint` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_operation_status( @@ -51,51 +58,52 @@ async def get_operation_status( private_endpoint_connection_name: str, operation_id: str, **kwargs: Any - ) -> "_models.OperationStatus": + ) -> _models.OperationStatus: """Gets the operation status for a private endpoint connection. Gets the operation status for a private endpoint connection. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param operation_id: Operation id. + :param operation_id: Operation id. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_operation_status_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_operation_status.metadata['url'], + template_url=self.get_operation_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,12 +111,11 @@ async def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore - + get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py index 5ff9f50b27f94..2fa9ea789115c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py @@ -7,105 +7,107 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protectable_containers_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectableContainersOperations: - """ProtectableContainersOperations 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. +class ProtectableContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protectable_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.ProtectableContainerResourceList"]: + self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ProtectableContainerResource"]: """Lists the containers that can be registered to Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: + :param fabric_name: Required. :type fabric_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectableContainerResourceList or the result of + :return: An iterator like instance of either ProtectableContainerResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectableContainerResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableContainerResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,10 +121,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -132,8 +132,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py index d394b735147ea..53b6e7a47f86e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py @@ -8,40 +8,47 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protected_item_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectedItemOperationResultsOperations: - """ProtectedItemOperationResultsOperations 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. +class ProtectedItemOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protected_item_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -53,56 +60,57 @@ async def get( protected_item_name: str, operation_id: str, **kwargs: Any - ) -> Optional["_models.ProtectedItemResource"]: + ) -> Optional[_models.ProtectedItemResource]: """Fetches the result of any operation on the backup item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Backup item name whose details are to be fetched. + :param protected_item_name: Backup item name whose details are to be fetched. Required. :type protected_item_name: str :param operation_id: OperationID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemResource, or the result of cls(response) + :return: ProtectedItemResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectedItemResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -111,12 +119,11 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectedItemResource', pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py index a7699b6cdd99d..8ed1e1a00ac69 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py @@ -8,40 +8,47 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protected_item_operation_statuses_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectedItemOperationStatusesOperations: - """ProtectedItemOperationStatusesOperations 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. +class ProtectedItemOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protected_item_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -53,71 +60,72 @@ async def get( protected_item_name: str, operation_id: str, **kwargs: Any - ) -> "_models.OperationStatus": + ) -> _models.OperationStatus: """Fetches the status of an operation such as triggering a backup, restore. The status can be in progress, completed or failed. You can refer to the OperationStatus enum for all the possible states of the operation. Some operations create jobs. This method returns the list of jobs associated with the operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Backup item name whose details are to be fetched. + :param protected_item_name: Backup item name whose details are to be fetched. Required. :type protected_item_name: str :param operation_id: OperationID represents the operation whose status needs to be fetched. + Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py index 28f214e597089..847736421102c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py @@ -6,42 +6,53 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._protected_items_operations import build_create_or_update_request, build_delete_request, build_get_request -T = TypeVar('T') +from ...operations._protected_items_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectedItemsOperations: - """ProtectedItemsOperations 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. +class ProtectedItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protected_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -53,72 +64,152 @@ async def get( protected_item_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> "_models.ProtectedItemResource": + ) -> _models.ProtectedItemResource: """Provides the details of the backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item name whose details are to be fetched. + :param protected_item_name: Backed up item name whose details are to be fetched. Required. :type protected_item_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemResource, or the result of cls(response) + :return: ProtectedItemResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.get.metadata['url'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectedItemResource', pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + + @overload + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: _models.ProtectedItemResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectedItemResource]: + """Enables backup of an item or to modifies the backup policy information of an already backed up + item. This is an + asynchronous operation. To know the status of the operation, call the GetItemOperationResult + API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Item name to be backed up. Required. + :type protected_item_name: str + :param parameters: resource backed up item. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectedItemResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectedItemResource]: + """Enables backup of an item or to modifies the backup policy information of an already backed up + item. This is an + asynchronous operation. To know the status of the operation, call the GetItemOperationResult + API. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Item name to be backed up. Required. + :type protected_item_name: str + :param parameters: resource backed up item. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectedItemResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_or_update( @@ -128,63 +219,76 @@ async def create_or_update( fabric_name: str, container_name: str, protected_item_name: str, - parameters: "_models.ProtectedItemResource", + parameters: Union[_models.ProtectedItemResource, IO], **kwargs: Any - ) -> Optional["_models.ProtectedItemResource"]: + ) -> Optional[_models.ProtectedItemResource]: """Enables backup of an item or to modifies the backup policy information of an already backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Item name to be backed up. + :param protected_item_name: Item name to be backed up. Required. :type protected_item_name: str - :param parameters: resource backed up item. + :param parameters: resource backed up item. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemResource, or the result of cls(response) + :return: ProtectedItemResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectedItemResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ProtectedItemResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectedItemResource") request = build_create_or_update_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -193,15 +297,14 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectedItemResource', pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -217,49 +320,50 @@ async def delete( # pylint: disable=inconsistent-return-statements know the status of the request, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item to be deleted. + :param protected_item_name: Backed up item to be deleted. Required. :type protected_item_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -269,5 +373,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py index 6352645001418..02916d77b9f01 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py @@ -8,40 +8,47 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_container_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionContainerOperationResultsOperations: - """ProtectionContainerOperationResultsOperations 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. +class ProtectionContainerOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_container_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( @@ -52,54 +59,55 @@ async def get( container_name: str, operation_id: str, **kwargs: Any - ) -> Optional["_models.ProtectionContainerResource"]: + ) -> Optional[_models.ProtectionContainerResource]: """Fetches the result of any operation on the container. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Container name whose information should be fetched. + :param container_name: Container name whose information should be fetched. Required. :type container_name: str :param operation_id: Operation ID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerResource, or the result of cls(response) + :return: ProtectionContainerResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -108,12 +116,11 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerResource', pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py index 82d476d4d8857..a86e122bc4a7d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py @@ -8,93 +8,96 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_container_refresh_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionContainerRefreshOperationResultsOperations: - """ProtectionContainerRefreshOperationResultsOperations 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. +class ProtectionContainerRefreshOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_container_refresh_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - operation_id: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, operation_id: str, **kwargs: Any ) -> None: """Provides the result of the refresh operation triggered by the BeginRefresh operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str :param operation_id: Operation ID associated with the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -104,5 +107,4 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py index c4bd38336d237..f16c0f8acd250 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py @@ -6,109 +6,194 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._protection_containers_operations import build_get_request, build_inquire_request, build_refresh_request, build_register_request, build_unregister_request -T = TypeVar('T') +from ...operations._protection_containers_operations import ( + build_get_request, + build_inquire_request, + build_refresh_request, + build_register_request, + build_unregister_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionContainersOperations: - """ProtectionContainersOperations 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. +class ProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - container_name: str, - **kwargs: Any - ) -> "_models.ProtectionContainerResource": + self, vault_name: str, resource_group_name: str, fabric_name: str, container_name: str, **kwargs: Any + ) -> _models.ProtectionContainerResource: """Gets details of the specific container registered to your Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Name of the fabric where the container belongs. + :param fabric_name: Name of the fabric where the container belongs. Required. :type fabric_name: str - :param container_name: Name of the container whose details need to be fetched. + :param container_name: Name of the container whose details need to be fetched. Required. :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerResource, or the result of cls(response) + :return: ProtectionContainerResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionContainerResource', pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + + @overload + async def register( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + parameters: _models.ProtectionContainerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionContainerResource]: + """Registers the container with Recovery Services vault. + This is an asynchronous operation. To track the operation status, use location header to call + get latest status of + the operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container to be registered. Required. + :type container_name: str + :param parameters: Request body for operation. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionContainerResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or + None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def register( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionContainerResource]: + """Registers the container with Recovery Services vault. + This is an asynchronous operation. To track the operation status, use location header to call + get latest status of + the operation. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container to be registered. Required. + :type container_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionContainerResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or + None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def register( @@ -117,62 +202,74 @@ async def register( resource_group_name: str, fabric_name: str, container_name: str, - parameters: "_models.ProtectionContainerResource", + parameters: Union[_models.ProtectionContainerResource, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainerResource"]: + ) -> Optional[_models.ProtectionContainerResource]: """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of the operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container to be registered. + :param container_name: Name of the container to be registered. Required. :type container_name: str - :param parameters: Request body for operation. + :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerResource, or the result of cls(response) + :return: ProtectionContainerResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ProtectionContainerResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectionContainerResource") request = build_register_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.register.metadata['url'], + content=_content, + template_url=self.register.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -181,71 +278,66 @@ async def register( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerResource', pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - register.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore - + register.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace_async async def unregister( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - container_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, container_name: str, **kwargs: Any ) -> None: """Unregisters the given container from your Recovery Services Vault. This is an asynchronous operation. To determine whether the backend service has finished processing the request, call Get Container Operation Result API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Name of the fabric where the container belongs. + :param fabric_name: Name of the fabric where the container belongs. Required. :type fabric_name: str :param container_name: Name of the container which needs to be unregistered from the Recovery - Services Vault. + Services Vault. Required. :type container_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_unregister_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.unregister.metadata['url'], + template_url=self.unregister.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -255,8 +347,7 @@ async def unregister( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - unregister.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore - + unregister.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace_async async def inquire( # pylint: disable=inconsistent-return-statements @@ -273,49 +364,50 @@ async def inquire( # pylint: disable=inconsistent-return-statements This is an async operation and the results should be tracked using location header or Azure-async-url. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric Name associated with the container. + :param fabric_name: Fabric Name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container in which inquiry needs to be triggered. + :param container_name: Name of the container in which inquiry needs to be triggered. Required. :type container_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_inquire_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.inquire.metadata['url'], + api_version=api_version, + template_url=self.inquire.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -325,63 +417,58 @@ async def inquire( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - inquire.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore - + inquire.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore @distributed_trace_async async def refresh( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - filter: Optional[str] = None, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any ) -> None: """Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated the container. + :param fabric_name: Fabric name associated the container. Required. :type fabric_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_refresh_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.refresh.metadata['url'], + api_version=api_version, + template_url=self.refresh.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -391,5 +478,4 @@ async def refresh( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - refresh.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore - + refresh.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py index 1f3a1256b37d4..9839aaf376aa7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py @@ -6,50 +6,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._protection_intent_operations import build_create_or_update_request, build_delete_request, build_get_request, build_validate_request -T = TypeVar('T') +from ...operations._protection_intent_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_validate_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionIntentOperations: - """ProtectionIntentOperations 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. +class ProtectionIntentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_intent` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def validate( self, azure_region: str, - parameters: "_models.PreValidateEnableBackupRequest", + parameters: _models.PreValidateEnableBackupRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.PreValidateEnableBackupResponse": + ) -> _models.PreValidateEnableBackupResponse: """It will validate followings @@ -64,26 +78,100 @@ async def validate( #. VM is already protected #. Any VM related configuration passed in properties. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Enable backup validation request on Virtual Machine. + :param parameters: Enable backup validation request on Virtual Machine. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PreValidateEnableBackupResponse, or the result of cls(response) + :return: PreValidateEnableBackupResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PreValidateEnableBackupResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + async def validate( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.PreValidateEnableBackupResponse: + """It will validate followings - _json = self._serialize.body(parameters, 'PreValidateEnableBackupRequest') + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + It will validate followings + + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Enable backup validation request on Virtual Machine. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreValidateEnableBackupResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def validate( + self, azure_region: str, parameters: Union[_models.PreValidateEnableBackupRequest, IO], **kwargs: Any + ) -> _models.PreValidateEnableBackupResponse: + """It will validate followings + + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + It will validate followings + + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Enable backup validation request on Virtual Machine. Is either a model type + or a IO type. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreValidateEnableBackupResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PreValidateEnableBackupResponse] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PreValidateEnableBackupRequest") request = build_validate_request( azure_region=azure_region, @@ -91,100 +179,165 @@ async def validate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate.metadata['url'], + content=_content, + template_url=self.validate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PreValidateEnableBackupResponse', pipeline_response) + deserialized = self._deserialize("PreValidateEnableBackupResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore - + validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - intent_object_name: str, - **kwargs: Any - ) -> "_models.ProtectionIntentResource": + self, vault_name: str, resource_group_name: str, fabric_name: str, intent_object_name: str, **kwargs: Any + ) -> _models.ProtectionIntentResource: """Provides the details of the protection intent up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param intent_object_name: Backed up item name whose details are to be fetched. + :param intent_object_name: Backed up item name whose details are to be fetched. Required. :type intent_object_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionIntentResource, or the result of cls(response) + :return: ProtectionIntentResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionIntentResource', pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + @overload + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + intent_object_name: str, + parameters: _models.ProtectionIntentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProtectionIntentResource: + """Create Intent for Enabling backup of an item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param intent_object_name: Intent object name. Required. + :type intent_object_name: str + :param parameters: resource backed up item. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionIntentResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + intent_object_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProtectionIntentResource: + """Create Intent for Enabling backup of an item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param intent_object_name: Intent object name. Required. + :type intent_object_name: str + :param parameters: resource backed up item. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionIntentResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_or_update( @@ -193,125 +346,132 @@ async def create_or_update( resource_group_name: str, fabric_name: str, intent_object_name: str, - parameters: "_models.ProtectionIntentResource", + parameters: Union[_models.ProtectionIntentResource, IO], **kwargs: Any - ) -> "_models.ProtectionIntentResource": + ) -> _models.ProtectionIntentResource: """Create Intent for Enabling backup of an item. This is a synchronous operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param intent_object_name: Intent object name. + :param intent_object_name: Intent object name. Required. :type intent_object_name: str - :param parameters: resource backed up item. + :param parameters: resource backed up item. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionIntentResource, or the result of cls(response) + :return: ProtectionIntentResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] - _json = self._serialize.body(parameters, 'ProtectionIntentResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectionIntentResource") request = build_create_or_update_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionIntentResource', pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore - + create_or_update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - intent_object_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, intent_object_name: str, **kwargs: Any ) -> None: """Used to remove intent from an item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the intent. + :param fabric_name: Fabric name associated with the intent. Required. :type fabric_name: str - :param intent_object_name: Intent to be deleted. + :param intent_object_name: Intent to be deleted. Required. :type intent_object_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -321,5 +481,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore - + delete.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py index 49cdaca128a7c..7123ff51f91bd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py @@ -6,109 +6,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._protection_policies_operations import build_create_or_update_request, build_delete_request_initial, build_get_request -T = TypeVar('T') +from ...operations._protection_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionPoliciesOperations: - """ProtectionPoliciesOperations 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. +class ProtectionPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - **kwargs: Any - ) -> "_models.ProtectionPolicyResource": + self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any + ) -> _models.ProtectionPolicyResource: """Provides the details of the backup policies associated to Recovery Services Vault. This is an asynchronous operation. Status of the operation can be fetched using GetPolicyOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy information to be fetched. + :param policy_name: Backup policy information to be fetched. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionPolicyResource, or the result of cls(response) + :return: ProtectionPolicyResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionPolicyResource', pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + @overload + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + policy_name: str, + parameters: _models.ProtectionPolicyResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionPolicyResource]: + """Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation + can be fetched + using GetPolicyOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param policy_name: Backup policy to be created. Required. + :type policy_name: str + :param parameters: resource backup policy. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionPolicyResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionPolicyResource]: + """Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation + can be fetched + using GetPolicyOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param policy_name: Backup policy to be created. Required. + :type policy_name: str + :param parameters: resource backup policy. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionPolicyResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def create_or_update( @@ -116,57 +190,69 @@ async def create_or_update( vault_name: str, resource_group_name: str, policy_name: str, - parameters: "_models.ProtectionPolicyResource", + parameters: Union[_models.ProtectionPolicyResource, IO], **kwargs: Any - ) -> Optional["_models.ProtectionPolicyResource"]: + ) -> Optional[_models.ProtectionPolicyResource]: """Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation can be fetched using GetPolicyOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy to be created. + :param policy_name: Backup policy to be created. Required. :type policy_name: str - :param parameters: resource backup policy. + :param parameters: resource backup policy. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionPolicyResource, or the result of cls(response) + :return: ProtectionPolicyResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionPolicyResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ProtectionPolicyResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionPolicyResource]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectionPolicyResource") request = build_create_or_update_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -175,48 +261,44 @@ async def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionPolicyResource', pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, policy_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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request_initial( + request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -226,27 +308,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - **kwargs: Any + async def begin_delete( + self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes specified backup policy from your Recovery Services Vault. This is an asynchronous operation. Status of the operation can be fetched using GetProtectionPolicyOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy to be deleted. + :param policy_name: Backup policy to be deleted. Required. :type policy_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. @@ -258,42 +335,46 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._delete_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, policy_name=policy_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py index 4341c6de824f6..26d24f47668e1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py @@ -8,105 +8,107 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_policy_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionPolicyOperationResultsOperations: - """ProtectionPolicyOperationResultsOperations 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. +class ProtectionPolicyOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_policy_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.ProtectionPolicyResource": + self, vault_name: str, resource_group_name: str, policy_name: str, operation_id: str, **kwargs: Any + ) -> _models.ProtectionPolicyResource: """Provides the result of an operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy name whose operation's result needs to be fetched. + :param policy_name: Backup policy name whose operation's result needs to be fetched. Required. :type policy_name: str :param operation_id: Operation ID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionPolicyResource, or the result of cls(response) + :return: ProtectionPolicyResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionPolicyResource', pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py index c5b7d29afb39b..d8f6790e6d165 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py @@ -8,109 +8,111 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_policy_operation_statuses_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ProtectionPolicyOperationStatusesOperations: - """ProtectionPolicyOperationStatusesOperations 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. +class ProtectionPolicyOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`protection_policy_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, policy_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Provides the status of the asynchronous operations like backup, restore. The status can be in progress, completed or failed. You can refer to the Operation Status enum for all the possible states of an operation. Some operations create jobs. This method returns the list of jobs associated with operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy name whose operation's status needs to be fetched. + :param policy_name: Backup policy name whose operation's status needs to be fetched. Required. :type policy_name: str :param operation_id: Operation ID which represents an operation whose status needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py index 3d69fbaafbc8e..3fe6c360dad51 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py @@ -7,43 +7,51 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_request, build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +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. +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -55,68 +63,65 @@ def list( protected_item_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPointResourceList"]: + ) -> AsyncIterable["_models.RecoveryPointResource"]: """Lists the backup copies for the backed up item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item whose backup copies are to be fetched. + :param protected_item_name: Backed up item whose backup copies are to be fetched. Required. :type protected_item_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointResourceList or the result of + :return: An iterator like instance of either RecoveryPointResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - protected_item_name=protected_item_name, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -130,10 +135,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,11 +146,9 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore @distributed_trace_async async def get( @@ -159,69 +160,71 @@ async def get( protected_item_name: str, recovery_point_id: str, **kwargs: Any - ) -> "_models.RecoveryPointResource": + ) -> _models.RecoveryPointResource: """Provides the information of the backed up data identified using RecoveryPointID. This is an asynchronous operation. To know the status of the operation, call the GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with backed up item. + :param fabric_name: Fabric name associated with backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with backed up item. + :param container_name: Container name associated with backed up item. Required. :type container_name: str :param protected_item_name: Backed up item name whose backup data needs to be fetched. + Required. :type protected_item_name: str :param recovery_point_id: RecoveryPointID represents the backed up data to be fetched. + Required. :type recovery_point_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPointResource, or the result of cls(response) + :return: RecoveryPointResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('RecoveryPointResource', pipeline_response) + deserialized = self._deserialize("RecoveryPointResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py index 01604b02714be..ae20b5eeef153 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py @@ -6,43 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._recovery_points_recommended_for_move_operations import build_list_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RecoveryPointsRecommendedForMoveOperations: - """RecoveryPointsRecommendedForMoveOperations 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. +class RecoveryPointsRecommendedForMoveOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`recovery_points_recommended_for_move` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,76 +60,83 @@ def list( fabric_name: str, container_name: str, protected_item_name: str, - parameters: "_models.ListRecoveryPointsRecommendedForMoveRequest", + parameters: Union[_models.ListRecoveryPointsRecommendedForMoveRequest, IO], **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPointResourceList"]: + ) -> AsyncIterable["_models.RecoveryPointResource"]: """Lists the recovery points recommended for move to another tier. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: + :param fabric_name: Required. :type fabric_name: str - :param container_name: + :param container_name: Required. :type container_name: str - :param protected_item_name: + :param protected_item_name: Required. :type protected_item_name: str - :param parameters: List Recovery points Recommended for Move Request. + :param parameters: List Recovery points Recommended for Move Request. Is either a model type or + a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ListRecoveryPointsRecommendedForMoveRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointResourceList or the result of + :return: An iterator like instance of either RecoveryPointResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - _json = self._serialize.body(parameters, 'ListRecoveryPointsRecommendedForMoveRequest') - + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ListRecoveryPointsRecommendedForMoveRequest") + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.list.metadata['url'], + content=_content, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - _json = self._serialize.body(parameters, 'ListRecoveryPointsRecommendedForMoveRequest') - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - protected_item_name=protected_item_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -135,10 +150,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -148,8 +161,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py index a703111d4f0d6..cbd8ff875f117 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py @@ -6,72 +6,83 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._recovery_services_backup_client_operations import build_bms_prepare_data_move_request_initial, build_bms_trigger_data_move_request_initial, build_get_operation_status_request, build_move_recovery_point_request_initial -T = TypeVar('T') +from ...operations._recovery_services_backup_client_operations import ( + build_bms_prepare_data_move_request, + build_bms_trigger_data_move_request, + build_get_operation_status_request, + build_move_recovery_point_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RecoveryServicesBackupClientOperationsMixin: +class RecoveryServicesBackupClientOperationsMixin(MixinABC): @distributed_trace_async async def get_operation_status( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Fetches operation status for data move operation on vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_operation_status_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_operation_status.metadata['url'], + template_url=self.get_operation_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -79,80 +90,162 @@ async def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore - + get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.PrepareDataMoveRequest", + parameters: Union[_models.PrepareDataMoveRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'PrepareDataMoveRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrepareDataMoveRequest") - request = build_bms_prepare_data_move_request_initial( + request = build_bms_prepare_data_move_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._bms_prepare_data_move_initial.metadata['url'], + content=_content, + template_url=self._bms_prepare_data_move_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _bms_prepare_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + _bms_prepare_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + + @overload + async def begin_bms_prepare_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.PrepareDataMoveRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Prepares source vault for Data Move operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Prepare data move request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @overload + async def begin_bms_prepare_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Prepares source vault for Data Move operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Prepare data move request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statements + async def begin_bms_prepare_data_move( self, vault_name: str, resource_group_name: str, - parameters: "_models.PrepareDataMoveRequest", + parameters: Union[_models.PrepareDataMoveRequest, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Prepares source vault for Data Move operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Prepare data move request. + :param parameters: Prepare data move request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -163,112 +256,199 @@ async def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._bms_prepare_data_move_initial( + raw_result = await self._bms_prepare_data_move_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_prepare_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + begin_bms_prepare_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.TriggerDataMoveRequest", + parameters: Union[_models.TriggerDataMoveRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'TriggerDataMoveRequest') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_bms_trigger_data_move_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TriggerDataMoveRequest") + + request = build_bms_trigger_data_move_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._bms_trigger_data_move_initial.metadata['url'], + content=_content, + template_url=self._bms_trigger_data_move_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _bms_trigger_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + _bms_trigger_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + + @overload + async def begin_bms_trigger_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.TriggerDataMoveRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers Data Move Operation on target vault. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Trigger data move request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_bms_trigger_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Triggers Data Move Operation on target vault. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Trigger data move request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statements + async def begin_bms_trigger_data_move( self, vault_name: str, resource_group_name: str, - parameters: "_models.TriggerDataMoveRequest", + parameters: Union[_models.TriggerDataMoveRequest, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Triggers Data Move Operation on target vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Trigger data move request. + :param parameters: Trigger data move request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -279,47 +459,51 @@ async def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-st Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._bms_trigger_data_move_initial( + raw_result = await self._bms_trigger_data_move_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_trigger_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + begin_bms_trigger_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements self, @@ -329,41 +513,50 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.MoveRPAcrossTiersRequest", + parameters: Union[_models.MoveRPAcrossTiersRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'MoveRPAcrossTiersRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MoveRPAcrossTiersRequest") - request = build_move_recovery_point_request_initial( + request = build_move_recovery_point_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._move_recovery_point_initial.metadata['url'], + content=_content, + template_url=self._move_recovery_point_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -373,11 +566,109 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s if cls: return cls(pipeline_response, None, {}) - _move_recovery_point_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + _move_recovery_point_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + + @overload + async def begin_move_recovery_point( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: _models.MoveRPAcrossTiersRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Move recovery point from one datastore to another store. + + Move recovery point from one datastore to another store. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Required. + :type fabric_name: str + :param container_name: Required. + :type container_name: str + :param protected_item_name: Required. + :type protected_item_name: str + :param recovery_point_id: Required. + :type recovery_point_id: str + :param parameters: Move Resource Across Tiers Request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_move_recovery_point( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Move recovery point from one datastore to another store. + + Move recovery point from one datastore to another store. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Required. + :type fabric_name: str + :param container_name: Required. + :type container_name: str + :param protected_item_name: Required. + :type protected_item_name: str + :param recovery_point_id: Required. + :type recovery_point_id: str + :param parameters: Move Resource Across Tiers Request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements + async def begin_move_recovery_point( self, vault_name: str, resource_group_name: str, @@ -385,29 +676,33 @@ async def begin_move_recovery_point( # pylint: disable=inconsistent-return-stat container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.MoveRPAcrossTiersRequest", + parameters: Union[_models.MoveRPAcrossTiersRequest, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Move recovery point from one datastore to another store. Move recovery point from one datastore to another store. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: + :param fabric_name: Required. :type fabric_name: str - :param container_name: + :param container_name: Required. :type container_name: str - :param protected_item_name: + :param protected_item_name: Required. :type protected_item_name: str - :param recovery_point_id: + :param recovery_point_id: Required. :type recovery_point_id: str - :param parameters: Move Resource Across Tiers Request. + :param parameters: Move Resource Across Tiers Request. Is either a model type or a IO type. + Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest + ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -418,19 +713,19 @@ async def begin_move_recovery_point( # pylint: disable=inconsistent-return-stat Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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._move_recovery_point_initial( + raw_result = await self._move_recovery_point_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -440,26 +735,30 @@ async def begin_move_recovery_point( # pylint: disable=inconsistent-return-stat parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_move_recovery_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + begin_move_recovery_point.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py index 5f5a37743032f..b6251db27b609 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py @@ -7,95 +7,101 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._resource_guard_proxies_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ResourceGuardProxiesOperations: - """ResourceGuardProxiesOperations 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. +class ResourceGuardProxiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`resource_guard_proxies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ResourceGuardProxyBaseResourceList"]: + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ResourceGuardProxyBaseResource"]: """List the ResourceGuardProxies under vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :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 ResourceGuardProxyBaseResourceList or the result - of cls(response) + :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_get_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -109,10 +115,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -122,8 +126,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py index fa09fc910eae4..0e78a949fe747 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py @@ -6,105 +6,178 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._resource_guard_proxy_operations import build_delete_request, build_get_request, build_put_request, build_unlock_delete_request -T = TypeVar('T') +from ...operations._resource_guard_proxy_operations import ( + build_delete_request, + build_get_request, + build_put_request, + build_unlock_delete_request, +) +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ResourceGuardProxyOperations: - """ResourceGuardProxyOperations 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. +class ResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`resource_guard_proxy` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - resource_guard_proxy_name: str, - **kwargs: Any - ) -> "_models.ResourceGuardProxyBaseResource": + self, vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: """Returns ResourceGuardProxy under vault and with the name referenced in request. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource, or the result of cls(response) + :return: ResourceGuardProxyBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceGuardProxyBaseResource', pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + @overload + async def put( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Add or Update ResourceGuardProxy under vault + Secures vault critical operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Add or Update ResourceGuardProxy under vault + Secures vault critical operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def put( @@ -112,119 +185,127 @@ async def put( vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, - parameters: "_models.ResourceGuardProxyBaseResource", + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], **kwargs: Any - ) -> "_models.ResourceGuardProxyBaseResource": + ) -> _models.ResourceGuardProxyBaseResource: """Add or Update ResourceGuardProxy under vault Secures vault critical operations. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str - :param parameters: Request body for operation. + :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource, or the result of cls(response) + :return: ResourceGuardProxyBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] - _json = self._serialize.body(parameters, 'ResourceGuardProxyBaseResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") request = build_put_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.put.metadata['url'], + content=_content, + template_url=self.put.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceGuardProxyBaseResource', pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - + put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - resource_guard_proxy_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, **kwargs: Any ) -> None: """Delete ResourceGuardProxy under vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -234,8 +315,69 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + + @overload + async def unlock_delete( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """Secures delete ResourceGuardProxy operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unlock_delete( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """Secures delete ResourceGuardProxy operations. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def unlock_delete( @@ -243,66 +385,78 @@ async def unlock_delete( vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, - parameters: "_models.UnlockDeleteRequest", + parameters: Union[_models.UnlockDeleteRequest, IO], **kwargs: Any - ) -> "_models.UnlockDeleteResponse": + ) -> _models.UnlockDeleteResponse: """Secures delete ResourceGuardProxy operations. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str - :param parameters: Request body for operation. - :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteRequest + :param parameters: Request body for operation. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse, or the result of cls(response) + :return: UnlockDeleteResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UnlockDeleteResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.UnlockDeleteResponse] - _json = self._serialize.body(parameters, 'UnlockDeleteRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UnlockDeleteRequest") request = build_unlock_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.unlock_delete.metadata['url'], + content=_content, + template_url=self.unlock_delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('UnlockDeleteResponse', pipeline_response) + deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unlock_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore - + unlock_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py index b1356fd5d7330..13e4fcf6deeff 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py @@ -6,44 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._restores_operations import build_trigger_request_initial -T = TypeVar('T') +from ...operations._restores_operations import build_trigger_request +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RestoresOperations: - """RestoresOperations 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. +class RestoresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`restores` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _trigger_initial( # pylint: disable=inconsistent-return-statements self, @@ -53,41 +60,50 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.RestoreRequestResource", + parameters: Union[_models.RestoreRequestResource, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'RestoreRequestResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RestoreRequestResource") - request = build_trigger_request_initial( + request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._trigger_initial.metadata['url'], + content=_content, + template_url=self._trigger_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -97,11 +113,110 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + @overload + async def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: _models.RestoreRequestResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores the specified backed up data. This is an asynchronous operation. To know the status of + this API call, use + GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item to be restored. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents the backed up data to be restored. + Required. + :type recovery_point_id: str + :param parameters: resource restore request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequestResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores the specified backed up data. This is an asynchronous operation. To know the status of + this API call, use + GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item to be restored. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents the backed up data to be restored. + Required. + :type recovery_point_id: str + :param parameters: resource restore request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_trigger( # pylint: disable=inconsistent-return-statements + async def begin_trigger( self, vault_name: str, resource_group_name: str, @@ -109,28 +224,33 @@ async def begin_trigger( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.RestoreRequestResource", + parameters: Union[_models.RestoreRequestResource, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Restores the specified backed up data. This is an asynchronous operation. To know the status of this API call, use GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up items. + :param fabric_name: Fabric name associated with the backed up items. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up items. + :param container_name: Container name associated with the backed up items. Required. :type container_name: str - :param protected_item_name: Backed up item to be restored. + :param protected_item_name: Backed up item to be restored. Required. :type protected_item_name: str :param recovery_point_id: Recovery point ID which represents the backed up data to be restored. + Required. :type recovery_point_id: str - :param parameters: resource restore request. + :param parameters: resource restore request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequestResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -141,19 +261,19 @@ async def begin_trigger( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._trigger_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -163,26 +283,30 @@ async def begin_trigger( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py index aae81b4ac56f7..fd3d7df51aa0d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py @@ -6,78 +6,152 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._security_pins_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class SecurityPINsOperations: - """SecurityPINsOperations 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. +class SecurityPINsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`security_pins` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def get( self, vault_name: str, resource_group_name: str, - parameters: Optional["_models.SecurityPinBase"] = None, + parameters: Optional[_models.SecurityPinBase] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.TokenInformation": + ) -> _models.TokenInformation: """Get the security PIN. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param parameters: security pin request. Default value is None. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SecurityPinBase + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TokenInformation, or the result of cls(response) + :return: TokenInformation or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenInformation"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + async def get( + self, + vault_name: str, + resource_group_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TokenInformation: + """Get the security PIN. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: security pin request. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TokenInformation or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ - if parameters is not None: - _json = self._serialize.body(parameters, 'SecurityPinBase') + @distributed_trace_async + async def get( + self, + vault_name: str, + resource_group_name: str, + parameters: Optional[Union[_models.SecurityPinBase, IO]] = None, + **kwargs: Any + ) -> _models.TokenInformation: + """Get the security PIN. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: security pin request. Is either a model type or a IO type. Default value is + None. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SecurityPinBase or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TokenInformation or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TokenInformation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "SecurityPinBase") + else: + _json = None request = build_get_request( vault_name=vault_name, @@ -86,28 +160,29 @@ async def get( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get.metadata['url'], + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TokenInformation', pipeline_response) + deserialized = self._deserialize("TokenInformation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py index 32205370281b7..a419bb7923160 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py @@ -6,80 +6,96 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._validate_operation_operations import build_trigger_request_initial -T = TypeVar('T') +from ...operations._validate_operation_operations import build_trigger_request +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ValidateOperationOperations: - """ValidateOperationOperations 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. +class ValidateOperationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`validate_operation` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _trigger_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.ValidateOperationRequest", + parameters: Union[_models.ValidateOperationRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ValidateOperationRequest') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_trigger_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateOperationRequest") + + request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._trigger_initial.metadata['url'], + content=_content, + template_url=self._trigger_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -89,28 +105,104 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + @overload + async def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.ValidateOperationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate operation for specified backed up item in the form of an asynchronous operation. + Returns tracking headers which can be tracked using GetValidateOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate operation for specified backed up item in the form of an asynchronous operation. + Returns tracking headers which can be tracked using GetValidateOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_trigger( # pylint: disable=inconsistent-return-statements + async def begin_trigger( self, vault_name: str, resource_group_name: str, - parameters: "_models.ValidateOperationRequest", + parameters: Union[_models.ValidateOperationRequest, IO], **kwargs: Any ) -> AsyncLROPoller[None]: """Validate operation for specified backed up item in the form of an asynchronous operation. Returns tracking headers which can be tracked using GetValidateOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource validate operation request. + :param parameters: resource validate operation request. Is either a model type or a IO type. + Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -121,44 +213,48 @@ async def begin_trigger( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._trigger_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py index ffe9f813086be..c618065d17c89 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py @@ -8,90 +8,94 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._validate_operation_results_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ValidateOperationResultsOperations: - """ValidateOperationResultsOperations 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. +class ValidateOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`validate_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> Optional["_models.ValidateOperationsResponse"]: + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.ValidateOperationsResponse]: """Fetches the result of a triggered validate operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param operation_id: OperationID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateOperationsResponse, or the result of cls(response) + :return: ValidateOperationsResponse or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateOperationsResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ValidateOperationsResponse]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -100,12 +104,11 @@ async def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ValidateOperationsResponse', pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py index 8ddddf78d5949..9bdae232a29a8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py @@ -8,104 +8,108 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._validate_operation_statuses_operations import build_get_request -T = TypeVar('T') +from .._vendor import MixinABC + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ValidateOperationStatusesOperations: - """ValidateOperationStatusesOperations 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. +class ValidateOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.activestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`validate_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Fetches the status of a triggered validate operation. The status can be in progress, completed or failed. You can refer to the OperationStatus enum for all the possible states of the operation. If operation has completed, this method returns the list of errors obtained while validating the operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param operation_id: OperationID represents the operation whose status needs to be fetched. + Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py index 7bdebc0b00857..35ce2a2fac753 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py @@ -58,9 +58,12 @@ from ._models_py3 import AzureVmWorkloadSAPAseDatabaseWorkloadItem from ._models_py3 import AzureVmWorkloadSAPAseSystemProtectableItem from ._models_py3 import AzureVmWorkloadSAPAseSystemWorkloadItem +from ._models_py3 import AzureVmWorkloadSAPHanaDBInstance +from ._models_py3 import AzureVmWorkloadSAPHanaDBInstanceProtectedItem from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseProtectableItem from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseProtectedItem from ._models_py3 import AzureVmWorkloadSAPHanaDatabaseWorkloadItem +from ._models_py3 import AzureVmWorkloadSAPHanaHSR from ._models_py3 import AzureVmWorkloadSAPHanaSystemProtectableItem from ._models_py3 import AzureVmWorkloadSAPHanaSystemWorkloadItem from ._models_py3 import AzureVmWorkloadSQLAvailabilityGroupProtectableItem @@ -273,6 +276,7 @@ from ._models_py3 import SubProtectionPolicy from ._models_py3 import TargetAFSRestoreInfo from ._models_py3 import TargetRestoreInfo +from ._models_py3 import TieringPolicy from ._models_py3 import TokenInformation from ._models_py3 import TriggerDataMoveRequest from ._models_py3 import UnlockDeleteRequest @@ -298,430 +302,440 @@ from ._models_py3 import WorkloadProtectableItemResourceList from ._models_py3 import YearlyRetentionSchedule - -from ._recovery_services_backup_client_enums import ( - AcquireStorageAccountLock, - AzureFileShareType, - BackupEngineType, - BackupItemType, - BackupManagementType, - BackupType, - ContainerType, - CopyOptions, - CreateMode, - DataMoveLevel, - DataSourceType, - DayOfWeek, - DedupState, - EncryptionAtRestType, - EnhancedSecurityState, - FabricName, - HealthState, - HealthStatus, - HttpStatusCode, - IAASVMPolicyType, - InfrastructureEncryptionState, - InquiryStatus, - IntentItemType, - JobOperationType, - JobStatus, - JobSupportedAction, - LastBackupStatus, - LastUpdateStatus, - MabServerType, - MonthOfYear, - OperationStatusValues, - OperationType, - OverwriteOptions, - PolicyType, - PrivateEndpointConnectionStatus, - ProtectedItemHealthStatus, - ProtectedItemState, - ProtectionIntentItemType, - ProtectionState, - ProtectionStatus, - ProvisioningState, - RecoveryMode, - RecoveryPointTierStatus, - RecoveryPointTierType, - RecoveryType, - RehydrationPriority, - ResourceHealthStatus, - RestorePointQueryType, - RestorePointType, - RestoreRequestType, - RetentionDurationType, - RetentionScheduleFormat, - SQLDataDirectoryType, - ScheduleRunType, - SoftDeleteFeatureState, - StorageType, - StorageTypeState, - SupportStatus, - Type, - UsagesUnit, - ValidationStatus, - WeekOfMonth, - WorkloadItemType, - WorkloadType, - XcoolState, -) +from ._recovery_services_backup_client_enums import AcquireStorageAccountLock +from ._recovery_services_backup_client_enums import AzureFileShareType +from ._recovery_services_backup_client_enums import BackupEngineType +from ._recovery_services_backup_client_enums import BackupItemType +from ._recovery_services_backup_client_enums import BackupManagementType +from ._recovery_services_backup_client_enums import BackupType +from ._recovery_services_backup_client_enums import ContainerType +from ._recovery_services_backup_client_enums import CopyOptions +from ._recovery_services_backup_client_enums import CreateMode +from ._recovery_services_backup_client_enums import DataMoveLevel +from ._recovery_services_backup_client_enums import DataSourceType +from ._recovery_services_backup_client_enums import DayOfWeek +from ._recovery_services_backup_client_enums import DedupState +from ._recovery_services_backup_client_enums import EncryptionAtRestType +from ._recovery_services_backup_client_enums import EnhancedSecurityState +from ._recovery_services_backup_client_enums import FabricName +from ._recovery_services_backup_client_enums import HealthState +from ._recovery_services_backup_client_enums import HealthStatus +from ._recovery_services_backup_client_enums import HttpStatusCode +from ._recovery_services_backup_client_enums import IAASVMPolicyType +from ._recovery_services_backup_client_enums import InfrastructureEncryptionState +from ._recovery_services_backup_client_enums import InquiryStatus +from ._recovery_services_backup_client_enums import IntentItemType +from ._recovery_services_backup_client_enums import JobOperationType +from ._recovery_services_backup_client_enums import JobStatus +from ._recovery_services_backup_client_enums import JobSupportedAction +from ._recovery_services_backup_client_enums import LastBackupStatus +from ._recovery_services_backup_client_enums import LastUpdateStatus +from ._recovery_services_backup_client_enums import MabServerType +from ._recovery_services_backup_client_enums import MonthOfYear +from ._recovery_services_backup_client_enums import OperationStatusValues +from ._recovery_services_backup_client_enums import OperationType +from ._recovery_services_backup_client_enums import OverwriteOptions +from ._recovery_services_backup_client_enums import PolicyType +from ._recovery_services_backup_client_enums import PrivateEndpointConnectionStatus +from ._recovery_services_backup_client_enums import ProtectableContainerType +from ._recovery_services_backup_client_enums import ProtectedItemHealthStatus +from ._recovery_services_backup_client_enums import ProtectedItemState +from ._recovery_services_backup_client_enums import ProtectionIntentItemType +from ._recovery_services_backup_client_enums import ProtectionState +from ._recovery_services_backup_client_enums import ProtectionStatus +from ._recovery_services_backup_client_enums import ProvisioningState +from ._recovery_services_backup_client_enums import RecoveryMode +from ._recovery_services_backup_client_enums import RecoveryPointTierStatus +from ._recovery_services_backup_client_enums import RecoveryPointTierType +from ._recovery_services_backup_client_enums import RecoveryType +from ._recovery_services_backup_client_enums import RehydrationPriority +from ._recovery_services_backup_client_enums import ResourceHealthStatus +from ._recovery_services_backup_client_enums import RestorePointQueryType +from ._recovery_services_backup_client_enums import RestorePointType +from ._recovery_services_backup_client_enums import RestoreRequestType +from ._recovery_services_backup_client_enums import RetentionDurationType +from ._recovery_services_backup_client_enums import RetentionScheduleFormat +from ._recovery_services_backup_client_enums import SQLDataDirectoryType +from ._recovery_services_backup_client_enums import ScheduleRunType +from ._recovery_services_backup_client_enums import SoftDeleteFeatureState +from ._recovery_services_backup_client_enums import StorageType +from ._recovery_services_backup_client_enums import StorageTypeState +from ._recovery_services_backup_client_enums import SupportStatus +from ._recovery_services_backup_client_enums import TieringMode +from ._recovery_services_backup_client_enums import Type +from ._recovery_services_backup_client_enums import UsagesUnit +from ._recovery_services_backup_client_enums import ValidationStatus +from ._recovery_services_backup_client_enums import WeekOfMonth +from ._recovery_services_backup_client_enums import WorkloadItemType +from ._recovery_services_backup_client_enums import WorkloadType +from ._recovery_services_backup_client_enums import XcoolState +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'AzureBackupGoalFeatureSupportRequest', - 'AzureBackupServerContainer', - 'AzureBackupServerEngine', - 'AzureFileShareBackupRequest', - 'AzureFileShareProtectableItem', - 'AzureFileShareProtectionPolicy', - 'AzureFileShareProvisionILRRequest', - 'AzureFileShareRecoveryPoint', - 'AzureFileShareRestoreRequest', - 'AzureFileshareProtectedItem', - 'AzureFileshareProtectedItemExtendedInfo', - 'AzureIaaSClassicComputeVMContainer', - 'AzureIaaSClassicComputeVMProtectableItem', - 'AzureIaaSClassicComputeVMProtectedItem', - 'AzureIaaSComputeVMContainer', - 'AzureIaaSComputeVMProtectableItem', - 'AzureIaaSComputeVMProtectedItem', - 'AzureIaaSVMErrorInfo', - 'AzureIaaSVMHealthDetails', - 'AzureIaaSVMJob', - 'AzureIaaSVMJobExtendedInfo', - 'AzureIaaSVMJobTaskDetails', - 'AzureIaaSVMJobV2', - 'AzureIaaSVMProtectedItem', - 'AzureIaaSVMProtectedItemExtendedInfo', - 'AzureIaaSVMProtectionPolicy', - 'AzureRecoveryServiceVaultProtectionIntent', - 'AzureResourceProtectionIntent', - 'AzureSQLAGWorkloadContainerProtectionContainer', - 'AzureSqlContainer', - 'AzureSqlProtectedItem', - 'AzureSqlProtectedItemExtendedInfo', - 'AzureSqlProtectionPolicy', - 'AzureStorageContainer', - 'AzureStorageErrorInfo', - 'AzureStorageJob', - 'AzureStorageJobExtendedInfo', - 'AzureStorageJobTaskDetails', - 'AzureStorageProtectableContainer', - 'AzureVMAppContainerProtectableContainer', - 'AzureVMAppContainerProtectionContainer', - 'AzureVMResourceFeatureSupportRequest', - 'AzureVMResourceFeatureSupportResponse', - 'AzureVmWorkloadItem', - 'AzureVmWorkloadProtectableItem', - 'AzureVmWorkloadProtectedItem', - 'AzureVmWorkloadProtectedItemExtendedInfo', - 'AzureVmWorkloadProtectionPolicy', - 'AzureVmWorkloadSAPAseDatabaseProtectedItem', - 'AzureVmWorkloadSAPAseDatabaseWorkloadItem', - 'AzureVmWorkloadSAPAseSystemProtectableItem', - 'AzureVmWorkloadSAPAseSystemWorkloadItem', - 'AzureVmWorkloadSAPHanaDatabaseProtectableItem', - 'AzureVmWorkloadSAPHanaDatabaseProtectedItem', - 'AzureVmWorkloadSAPHanaDatabaseWorkloadItem', - 'AzureVmWorkloadSAPHanaSystemProtectableItem', - 'AzureVmWorkloadSAPHanaSystemWorkloadItem', - 'AzureVmWorkloadSQLAvailabilityGroupProtectableItem', - 'AzureVmWorkloadSQLDatabaseProtectableItem', - 'AzureVmWorkloadSQLDatabaseProtectedItem', - 'AzureVmWorkloadSQLDatabaseWorkloadItem', - 'AzureVmWorkloadSQLInstanceProtectableItem', - 'AzureVmWorkloadSQLInstanceWorkloadItem', - 'AzureWorkloadAutoProtectionIntent', - 'AzureWorkloadBackupRequest', - 'AzureWorkloadContainer', - 'AzureWorkloadContainerAutoProtectionIntent', - 'AzureWorkloadContainerExtendedInfo', - 'AzureWorkloadErrorInfo', - 'AzureWorkloadJob', - 'AzureWorkloadJobExtendedInfo', - 'AzureWorkloadJobTaskDetails', - 'AzureWorkloadPointInTimeRecoveryPoint', - 'AzureWorkloadPointInTimeRestoreRequest', - 'AzureWorkloadRecoveryPoint', - 'AzureWorkloadRestoreRequest', - 'AzureWorkloadSAPHanaPointInTimeRecoveryPoint', - 'AzureWorkloadSAPHanaPointInTimeRestoreRequest', - 'AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest', - 'AzureWorkloadSAPHanaRecoveryPoint', - 'AzureWorkloadSAPHanaRestoreRequest', - 'AzureWorkloadSAPHanaRestoreWithRehydrateRequest', - 'AzureWorkloadSQLAutoProtectionIntent', - 'AzureWorkloadSQLPointInTimeRecoveryPoint', - 'AzureWorkloadSQLPointInTimeRestoreRequest', - 'AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest', - 'AzureWorkloadSQLRecoveryPoint', - 'AzureWorkloadSQLRecoveryPointExtendedInfo', - 'AzureWorkloadSQLRestoreRequest', - 'AzureWorkloadSQLRestoreWithRehydrateRequest', - 'BEKDetails', - 'BMSBackupEngineQueryObject', - 'BMSBackupEnginesQueryObject', - 'BMSBackupSummariesQueryObject', - 'BMSContainerQueryObject', - 'BMSContainersInquiryQueryObject', - 'BMSPOQueryObject', - 'BMSRPQueryObject', - 'BMSRefreshContainersQueryObject', - 'BMSWorkloadItemQueryObject', - 'BackupEngineBase', - 'BackupEngineBaseResource', - 'BackupEngineBaseResourceList', - 'BackupEngineExtendedInfo', - 'BackupManagementUsage', - 'BackupManagementUsageList', - 'BackupRequest', - 'BackupRequestResource', - 'BackupResourceConfig', - 'BackupResourceConfigResource', - 'BackupResourceEncryptionConfig', - 'BackupResourceEncryptionConfigExtended', - 'BackupResourceEncryptionConfigExtendedResource', - 'BackupResourceEncryptionConfigResource', - 'BackupResourceVaultConfig', - 'BackupResourceVaultConfigResource', - 'BackupStatusRequest', - 'BackupStatusResponse', - 'ClientDiscoveryDisplay', - 'ClientDiscoveryForLogSpecification', - 'ClientDiscoveryForProperties', - 'ClientDiscoveryForServiceSpecification', - 'ClientDiscoveryResponse', - 'ClientDiscoveryValueForSingleApi', - 'ClientScriptForConnect', - 'CloudErrorBody', - 'ContainerIdentityInfo', - 'DPMContainerExtendedInfo', - 'DPMProtectedItem', - 'DPMProtectedItemExtendedInfo', - 'DailyRetentionFormat', - 'DailyRetentionSchedule', - 'DailySchedule', - 'Day', - 'DiskExclusionProperties', - 'DiskInformation', - 'DistributedNodesInfo', - 'DpmBackupEngine', - 'DpmContainer', - 'DpmErrorInfo', - 'DpmJob', - 'DpmJobExtendedInfo', - 'DpmJobTaskDetails', - 'EncryptionDetails', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ExportJobsOperationResultInfo', - 'ExtendedProperties', - 'FeatureSupportRequest', - 'GenericContainer', - 'GenericContainerExtendedInfo', - 'GenericProtectedItem', - 'GenericProtectionPolicy', - 'GenericRecoveryPoint', - 'GetProtectedItemQueryObject', - 'HourlySchedule', - 'ILRRequest', - 'ILRRequestResource', - 'IaaSVMContainer', - 'IaaSVMProtectableItem', - 'IaasVMBackupRequest', - 'IaasVMILRRegistrationRequest', - 'IaasVMRecoveryPoint', - 'IaasVMRestoreRequest', - 'IaasVMRestoreWithRehydrationRequest', - 'IdentityBasedRestoreDetails', - 'IdentityInfo', - 'InquiryInfo', - 'InquiryValidation', - 'InstantItemRecoveryTarget', - 'InstantRPAdditionalDetails', - 'Job', - 'JobQueryObject', - 'JobResource', - 'JobResourceList', - 'KEKDetails', - 'KPIResourceHealthDetails', - 'KeyAndSecretDetails', - 'ListRecoveryPointsRecommendedForMoveRequest', - 'LogSchedulePolicy', - 'LongTermRetentionPolicy', - 'LongTermSchedulePolicy', - 'MABContainerHealthDetails', - 'MabContainer', - 'MabContainerExtendedInfo', - 'MabErrorInfo', - 'MabFileFolderProtectedItem', - 'MabFileFolderProtectedItemExtendedInfo', - 'MabJob', - 'MabJobExtendedInfo', - 'MabJobTaskDetails', - 'MabProtectionPolicy', - 'MonthlyRetentionSchedule', - 'MoveRPAcrossTiersRequest', - 'NameInfo', - 'NewErrorResponse', - 'NewErrorResponseError', - 'OperationResultInfo', - 'OperationResultInfoBase', - 'OperationResultInfoBaseResource', - 'OperationStatus', - 'OperationStatusError', - 'OperationStatusExtendedInfo', - 'OperationStatusJobExtendedInfo', - 'OperationStatusJobsExtendedInfo', - 'OperationStatusProvisionILRExtendedInfo', - 'OperationStatusValidateOperationExtendedInfo', - 'OperationWorkerResponse', - 'PointInTimeRange', - 'PreBackupValidation', - 'PreValidateEnableBackupRequest', - 'PreValidateEnableBackupResponse', - 'PrepareDataMoveRequest', - 'PrepareDataMoveResponse', - 'PrivateEndpoint', - 'PrivateEndpointConnection', - 'PrivateEndpointConnectionResource', - 'PrivateLinkServiceConnectionState', - 'ProtectableContainer', - 'ProtectableContainerResource', - 'ProtectableContainerResourceList', - 'ProtectedItem', - 'ProtectedItemQueryObject', - 'ProtectedItemResource', - 'ProtectedItemResourceList', - 'ProtectionContainer', - 'ProtectionContainerResource', - 'ProtectionContainerResourceList', - 'ProtectionIntent', - 'ProtectionIntentQueryObject', - 'ProtectionIntentResource', - 'ProtectionIntentResourceList', - 'ProtectionPolicy', - 'ProtectionPolicyQueryObject', - 'ProtectionPolicyResource', - 'ProtectionPolicyResourceList', - 'RecoveryPoint', - 'RecoveryPointDiskConfiguration', - 'RecoveryPointMoveReadinessInfo', - 'RecoveryPointRehydrationInfo', - 'RecoveryPointResource', - 'RecoveryPointResourceList', - 'RecoveryPointTierInformation', - 'RecoveryPointTierInformationV2', - 'Resource', - 'ResourceGuardOperationDetail', - 'ResourceGuardProxyBase', - 'ResourceGuardProxyBaseResource', - 'ResourceGuardProxyBaseResourceList', - 'ResourceHealthDetails', - 'ResourceList', - 'RestoreFileSpecs', - 'RestoreRequest', - 'RestoreRequestResource', - 'RetentionDuration', - 'RetentionPolicy', - 'SQLDataDirectory', - 'SQLDataDirectoryMapping', - 'SchedulePolicy', - 'SecurityPinBase', - 'Settings', - 'SimpleRetentionPolicy', - 'SimpleSchedulePolicy', - 'SimpleSchedulePolicyV2', - 'SubProtectionPolicy', - 'TargetAFSRestoreInfo', - 'TargetRestoreInfo', - 'TokenInformation', - 'TriggerDataMoveRequest', - 'UnlockDeleteRequest', - 'UnlockDeleteResponse', - 'ValidateIaasVMRestoreOperationRequest', - 'ValidateOperationRequest', - 'ValidateOperationResponse', - 'ValidateOperationsResponse', - 'ValidateRestoreOperationRequest', - 'VaultJob', - 'VaultJobErrorInfo', - 'VaultJobExtendedInfo', - 'VaultStorageConfigOperationResultResponse', - 'WeeklyRetentionFormat', - 'WeeklyRetentionSchedule', - 'WeeklySchedule', - 'WorkloadInquiryDetails', - 'WorkloadItem', - 'WorkloadItemResource', - 'WorkloadItemResourceList', - 'WorkloadProtectableItem', - 'WorkloadProtectableItemResource', - 'WorkloadProtectableItemResourceList', - 'YearlyRetentionSchedule', - 'AcquireStorageAccountLock', - 'AzureFileShareType', - 'BackupEngineType', - 'BackupItemType', - 'BackupManagementType', - 'BackupType', - 'ContainerType', - 'CopyOptions', - 'CreateMode', - 'DataMoveLevel', - 'DataSourceType', - 'DayOfWeek', - 'DedupState', - 'EncryptionAtRestType', - 'EnhancedSecurityState', - 'FabricName', - 'HealthState', - 'HealthStatus', - 'HttpStatusCode', - 'IAASVMPolicyType', - 'InfrastructureEncryptionState', - 'InquiryStatus', - 'IntentItemType', - 'JobOperationType', - 'JobStatus', - 'JobSupportedAction', - 'LastBackupStatus', - 'LastUpdateStatus', - 'MabServerType', - 'MonthOfYear', - 'OperationStatusValues', - 'OperationType', - 'OverwriteOptions', - 'PolicyType', - 'PrivateEndpointConnectionStatus', - 'ProtectedItemHealthStatus', - 'ProtectedItemState', - 'ProtectionIntentItemType', - 'ProtectionState', - 'ProtectionStatus', - 'ProvisioningState', - 'RecoveryMode', - 'RecoveryPointTierStatus', - 'RecoveryPointTierType', - 'RecoveryType', - 'RehydrationPriority', - 'ResourceHealthStatus', - 'RestorePointQueryType', - 'RestorePointType', - 'RestoreRequestType', - 'RetentionDurationType', - 'RetentionScheduleFormat', - 'SQLDataDirectoryType', - 'ScheduleRunType', - 'SoftDeleteFeatureState', - 'StorageType', - 'StorageTypeState', - 'SupportStatus', - 'Type', - 'UsagesUnit', - 'ValidationStatus', - 'WeekOfMonth', - 'WorkloadItemType', - 'WorkloadType', - 'XcoolState', + "AzureBackupGoalFeatureSupportRequest", + "AzureBackupServerContainer", + "AzureBackupServerEngine", + "AzureFileShareBackupRequest", + "AzureFileShareProtectableItem", + "AzureFileShareProtectionPolicy", + "AzureFileShareProvisionILRRequest", + "AzureFileShareRecoveryPoint", + "AzureFileShareRestoreRequest", + "AzureFileshareProtectedItem", + "AzureFileshareProtectedItemExtendedInfo", + "AzureIaaSClassicComputeVMContainer", + "AzureIaaSClassicComputeVMProtectableItem", + "AzureIaaSClassicComputeVMProtectedItem", + "AzureIaaSComputeVMContainer", + "AzureIaaSComputeVMProtectableItem", + "AzureIaaSComputeVMProtectedItem", + "AzureIaaSVMErrorInfo", + "AzureIaaSVMHealthDetails", + "AzureIaaSVMJob", + "AzureIaaSVMJobExtendedInfo", + "AzureIaaSVMJobTaskDetails", + "AzureIaaSVMJobV2", + "AzureIaaSVMProtectedItem", + "AzureIaaSVMProtectedItemExtendedInfo", + "AzureIaaSVMProtectionPolicy", + "AzureRecoveryServiceVaultProtectionIntent", + "AzureResourceProtectionIntent", + "AzureSQLAGWorkloadContainerProtectionContainer", + "AzureSqlContainer", + "AzureSqlProtectedItem", + "AzureSqlProtectedItemExtendedInfo", + "AzureSqlProtectionPolicy", + "AzureStorageContainer", + "AzureStorageErrorInfo", + "AzureStorageJob", + "AzureStorageJobExtendedInfo", + "AzureStorageJobTaskDetails", + "AzureStorageProtectableContainer", + "AzureVMAppContainerProtectableContainer", + "AzureVMAppContainerProtectionContainer", + "AzureVMResourceFeatureSupportRequest", + "AzureVMResourceFeatureSupportResponse", + "AzureVmWorkloadItem", + "AzureVmWorkloadProtectableItem", + "AzureVmWorkloadProtectedItem", + "AzureVmWorkloadProtectedItemExtendedInfo", + "AzureVmWorkloadProtectionPolicy", + "AzureVmWorkloadSAPAseDatabaseProtectedItem", + "AzureVmWorkloadSAPAseDatabaseWorkloadItem", + "AzureVmWorkloadSAPAseSystemProtectableItem", + "AzureVmWorkloadSAPAseSystemWorkloadItem", + "AzureVmWorkloadSAPHanaDBInstance", + "AzureVmWorkloadSAPHanaDBInstanceProtectedItem", + "AzureVmWorkloadSAPHanaDatabaseProtectableItem", + "AzureVmWorkloadSAPHanaDatabaseProtectedItem", + "AzureVmWorkloadSAPHanaDatabaseWorkloadItem", + "AzureVmWorkloadSAPHanaHSR", + "AzureVmWorkloadSAPHanaSystemProtectableItem", + "AzureVmWorkloadSAPHanaSystemWorkloadItem", + "AzureVmWorkloadSQLAvailabilityGroupProtectableItem", + "AzureVmWorkloadSQLDatabaseProtectableItem", + "AzureVmWorkloadSQLDatabaseProtectedItem", + "AzureVmWorkloadSQLDatabaseWorkloadItem", + "AzureVmWorkloadSQLInstanceProtectableItem", + "AzureVmWorkloadSQLInstanceWorkloadItem", + "AzureWorkloadAutoProtectionIntent", + "AzureWorkloadBackupRequest", + "AzureWorkloadContainer", + "AzureWorkloadContainerAutoProtectionIntent", + "AzureWorkloadContainerExtendedInfo", + "AzureWorkloadErrorInfo", + "AzureWorkloadJob", + "AzureWorkloadJobExtendedInfo", + "AzureWorkloadJobTaskDetails", + "AzureWorkloadPointInTimeRecoveryPoint", + "AzureWorkloadPointInTimeRestoreRequest", + "AzureWorkloadRecoveryPoint", + "AzureWorkloadRestoreRequest", + "AzureWorkloadSAPHanaPointInTimeRecoveryPoint", + "AzureWorkloadSAPHanaPointInTimeRestoreRequest", + "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest", + "AzureWorkloadSAPHanaRecoveryPoint", + "AzureWorkloadSAPHanaRestoreRequest", + "AzureWorkloadSAPHanaRestoreWithRehydrateRequest", + "AzureWorkloadSQLAutoProtectionIntent", + "AzureWorkloadSQLPointInTimeRecoveryPoint", + "AzureWorkloadSQLPointInTimeRestoreRequest", + "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest", + "AzureWorkloadSQLRecoveryPoint", + "AzureWorkloadSQLRecoveryPointExtendedInfo", + "AzureWorkloadSQLRestoreRequest", + "AzureWorkloadSQLRestoreWithRehydrateRequest", + "BEKDetails", + "BMSBackupEngineQueryObject", + "BMSBackupEnginesQueryObject", + "BMSBackupSummariesQueryObject", + "BMSContainerQueryObject", + "BMSContainersInquiryQueryObject", + "BMSPOQueryObject", + "BMSRPQueryObject", + "BMSRefreshContainersQueryObject", + "BMSWorkloadItemQueryObject", + "BackupEngineBase", + "BackupEngineBaseResource", + "BackupEngineBaseResourceList", + "BackupEngineExtendedInfo", + "BackupManagementUsage", + "BackupManagementUsageList", + "BackupRequest", + "BackupRequestResource", + "BackupResourceConfig", + "BackupResourceConfigResource", + "BackupResourceEncryptionConfig", + "BackupResourceEncryptionConfigExtended", + "BackupResourceEncryptionConfigExtendedResource", + "BackupResourceEncryptionConfigResource", + "BackupResourceVaultConfig", + "BackupResourceVaultConfigResource", + "BackupStatusRequest", + "BackupStatusResponse", + "ClientDiscoveryDisplay", + "ClientDiscoveryForLogSpecification", + "ClientDiscoveryForProperties", + "ClientDiscoveryForServiceSpecification", + "ClientDiscoveryResponse", + "ClientDiscoveryValueForSingleApi", + "ClientScriptForConnect", + "CloudErrorBody", + "ContainerIdentityInfo", + "DPMContainerExtendedInfo", + "DPMProtectedItem", + "DPMProtectedItemExtendedInfo", + "DailyRetentionFormat", + "DailyRetentionSchedule", + "DailySchedule", + "Day", + "DiskExclusionProperties", + "DiskInformation", + "DistributedNodesInfo", + "DpmBackupEngine", + "DpmContainer", + "DpmErrorInfo", + "DpmJob", + "DpmJobExtendedInfo", + "DpmJobTaskDetails", + "EncryptionDetails", + "ErrorAdditionalInfo", + "ErrorDetail", + "ExportJobsOperationResultInfo", + "ExtendedProperties", + "FeatureSupportRequest", + "GenericContainer", + "GenericContainerExtendedInfo", + "GenericProtectedItem", + "GenericProtectionPolicy", + "GenericRecoveryPoint", + "GetProtectedItemQueryObject", + "HourlySchedule", + "ILRRequest", + "ILRRequestResource", + "IaaSVMContainer", + "IaaSVMProtectableItem", + "IaasVMBackupRequest", + "IaasVMILRRegistrationRequest", + "IaasVMRecoveryPoint", + "IaasVMRestoreRequest", + "IaasVMRestoreWithRehydrationRequest", + "IdentityBasedRestoreDetails", + "IdentityInfo", + "InquiryInfo", + "InquiryValidation", + "InstantItemRecoveryTarget", + "InstantRPAdditionalDetails", + "Job", + "JobQueryObject", + "JobResource", + "JobResourceList", + "KEKDetails", + "KPIResourceHealthDetails", + "KeyAndSecretDetails", + "ListRecoveryPointsRecommendedForMoveRequest", + "LogSchedulePolicy", + "LongTermRetentionPolicy", + "LongTermSchedulePolicy", + "MABContainerHealthDetails", + "MabContainer", + "MabContainerExtendedInfo", + "MabErrorInfo", + "MabFileFolderProtectedItem", + "MabFileFolderProtectedItemExtendedInfo", + "MabJob", + "MabJobExtendedInfo", + "MabJobTaskDetails", + "MabProtectionPolicy", + "MonthlyRetentionSchedule", + "MoveRPAcrossTiersRequest", + "NameInfo", + "NewErrorResponse", + "NewErrorResponseError", + "OperationResultInfo", + "OperationResultInfoBase", + "OperationResultInfoBaseResource", + "OperationStatus", + "OperationStatusError", + "OperationStatusExtendedInfo", + "OperationStatusJobExtendedInfo", + "OperationStatusJobsExtendedInfo", + "OperationStatusProvisionILRExtendedInfo", + "OperationStatusValidateOperationExtendedInfo", + "OperationWorkerResponse", + "PointInTimeRange", + "PreBackupValidation", + "PreValidateEnableBackupRequest", + "PreValidateEnableBackupResponse", + "PrepareDataMoveRequest", + "PrepareDataMoveResponse", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionResource", + "PrivateLinkServiceConnectionState", + "ProtectableContainer", + "ProtectableContainerResource", + "ProtectableContainerResourceList", + "ProtectedItem", + "ProtectedItemQueryObject", + "ProtectedItemResource", + "ProtectedItemResourceList", + "ProtectionContainer", + "ProtectionContainerResource", + "ProtectionContainerResourceList", + "ProtectionIntent", + "ProtectionIntentQueryObject", + "ProtectionIntentResource", + "ProtectionIntentResourceList", + "ProtectionPolicy", + "ProtectionPolicyQueryObject", + "ProtectionPolicyResource", + "ProtectionPolicyResourceList", + "RecoveryPoint", + "RecoveryPointDiskConfiguration", + "RecoveryPointMoveReadinessInfo", + "RecoveryPointRehydrationInfo", + "RecoveryPointResource", + "RecoveryPointResourceList", + "RecoveryPointTierInformation", + "RecoveryPointTierInformationV2", + "Resource", + "ResourceGuardOperationDetail", + "ResourceGuardProxyBase", + "ResourceGuardProxyBaseResource", + "ResourceGuardProxyBaseResourceList", + "ResourceHealthDetails", + "ResourceList", + "RestoreFileSpecs", + "RestoreRequest", + "RestoreRequestResource", + "RetentionDuration", + "RetentionPolicy", + "SQLDataDirectory", + "SQLDataDirectoryMapping", + "SchedulePolicy", + "SecurityPinBase", + "Settings", + "SimpleRetentionPolicy", + "SimpleSchedulePolicy", + "SimpleSchedulePolicyV2", + "SubProtectionPolicy", + "TargetAFSRestoreInfo", + "TargetRestoreInfo", + "TieringPolicy", + "TokenInformation", + "TriggerDataMoveRequest", + "UnlockDeleteRequest", + "UnlockDeleteResponse", + "ValidateIaasVMRestoreOperationRequest", + "ValidateOperationRequest", + "ValidateOperationResponse", + "ValidateOperationsResponse", + "ValidateRestoreOperationRequest", + "VaultJob", + "VaultJobErrorInfo", + "VaultJobExtendedInfo", + "VaultStorageConfigOperationResultResponse", + "WeeklyRetentionFormat", + "WeeklyRetentionSchedule", + "WeeklySchedule", + "WorkloadInquiryDetails", + "WorkloadItem", + "WorkloadItemResource", + "WorkloadItemResourceList", + "WorkloadProtectableItem", + "WorkloadProtectableItemResource", + "WorkloadProtectableItemResourceList", + "YearlyRetentionSchedule", + "AcquireStorageAccountLock", + "AzureFileShareType", + "BackupEngineType", + "BackupItemType", + "BackupManagementType", + "BackupType", + "ContainerType", + "CopyOptions", + "CreateMode", + "DataMoveLevel", + "DataSourceType", + "DayOfWeek", + "DedupState", + "EncryptionAtRestType", + "EnhancedSecurityState", + "FabricName", + "HealthState", + "HealthStatus", + "HttpStatusCode", + "IAASVMPolicyType", + "InfrastructureEncryptionState", + "InquiryStatus", + "IntentItemType", + "JobOperationType", + "JobStatus", + "JobSupportedAction", + "LastBackupStatus", + "LastUpdateStatus", + "MabServerType", + "MonthOfYear", + "OperationStatusValues", + "OperationType", + "OverwriteOptions", + "PolicyType", + "PrivateEndpointConnectionStatus", + "ProtectableContainerType", + "ProtectedItemHealthStatus", + "ProtectedItemState", + "ProtectionIntentItemType", + "ProtectionState", + "ProtectionStatus", + "ProvisioningState", + "RecoveryMode", + "RecoveryPointTierStatus", + "RecoveryPointTierType", + "RecoveryType", + "RehydrationPriority", + "ResourceHealthStatus", + "RestorePointQueryType", + "RestorePointType", + "RestoreRequestType", + "RetentionDurationType", + "RetentionScheduleFormat", + "SQLDataDirectoryType", + "ScheduleRunType", + "SoftDeleteFeatureState", + "StorageType", + "StorageTypeState", + "SupportStatus", + "TieringMode", + "Type", + "UsagesUnit", + "ValidationStatus", + "WeekOfMonth", + "WorkloadItemType", + "WorkloadType", + "XcoolState", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py index 0a14cfe4400f4..0061b4b16975d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,45 +8,45 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from .. import _serialization -from ._recovery_services_backup_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class FeatureSupportRequest(msrest.serialization.Model): +class FeatureSupportRequest(_serialization.Model): """Base class for feature request. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupGoalFeatureSupportRequest, AzureVMResourceFeatureSupportRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupGoalFeatureSupportRequest, AzureVMResourceFeatureSupportRequest All required parameters must be populated in order to send to Azure. - :ivar feature_type: Required. backup support feature type.Constant filled by server. + :ivar feature_type: backup support feature type. Required. :vartype feature_type: str """ _validation = { - 'feature_type': {'required': True}, + "feature_type": {"required": True}, } _attribute_map = { - 'feature_type': {'key': 'featureType', 'type': 'str'}, + "feature_type": {"key": "featureType", "type": "str"}, } _subtype_map = { - 'feature_type': {'AzureBackupGoals': 'AzureBackupGoalFeatureSupportRequest', 'AzureVMResourceBackup': 'AzureVMResourceFeatureSupportRequest'} + "feature_type": { + "AzureBackupGoals": "AzureBackupGoalFeatureSupportRequest", + "AzureVMResourceBackup": "AzureVMResourceFeatureSupportRequest", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(FeatureSupportRequest, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.feature_type = None # type: Optional[str] @@ -54,41 +55,38 @@ class AzureBackupGoalFeatureSupportRequest(FeatureSupportRequest): All required parameters must be populated in order to send to Azure. - :ivar feature_type: Required. backup support feature type.Constant filled by server. + :ivar feature_type: backup support feature type. Required. :vartype feature_type: str """ _validation = { - 'feature_type': {'required': True}, + "feature_type": {"required": True}, } _attribute_map = { - 'feature_type': {'key': 'featureType', 'type': 'str'}, + "feature_type": {"key": "featureType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureBackupGoalFeatureSupportRequest, self).__init__(**kwargs) - self.feature_type = 'AzureBackupGoals' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.feature_type = "AzureBackupGoals" # type: str -class ProtectionContainer(msrest.serialization.Model): +class ProtectionContainer(_serialization.Model): """Base class for container with backup items. Containers with specific workloads are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureSqlContainer, AzureWorkloadContainer, DpmContainer, GenericContainer, IaaSVMContainer, AzureStorageContainer, MabContainer. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureSqlContainer, AzureWorkloadContainer, DpmContainer, GenericContainer, IaaSVMContainer, + AzureStorageContainer, MabContainer All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -96,46 +94,54 @@ class ProtectionContainer(msrest.serialization.Model): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, } _subtype_map = { - 'container_type': {'AzureSqlContainer': 'AzureSqlContainer', 'AzureWorkloadContainer': 'AzureWorkloadContainer', 'DPMContainer': 'DpmContainer', 'GenericContainer': 'GenericContainer', 'IaasVMContainer': 'IaaSVMContainer', 'StorageContainer': 'AzureStorageContainer', 'Windows': 'MabContainer'} + "container_type": { + "AzureSqlContainer": "AzureSqlContainer", + "AzureWorkloadContainer": "AzureWorkloadContainer", + "DPMContainer": "DpmContainer", + "GenericContainer": "GenericContainer", + "IaasVMContainer": "IaaSVMContainer", + "StorageContainer": "AzureStorageContainer", + "Windows": "MabContainer", + } } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -144,9 +150,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -158,7 +164,7 @@ def __init__( container. :paramtype protectable_object_type: str """ - super(ProtectionContainer, self).__init__(**kwargs) + super().__init__(**kwargs) self.friendly_name = friendly_name self.backup_management_type = backup_management_type self.registration_status = registration_status @@ -167,19 +173,19 @@ def __init__( self.protectable_object_type = protectable_object_type -class DpmContainer(ProtectionContainer): +class DpmContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes """DPM workload-specific protection container. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupServerContainer. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupServerContainer All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -187,20 +193,20 @@ class DpmContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar can_re_register: Specifies whether the container is re-registrable. @@ -208,7 +214,7 @@ class DpmContainer(ProtectionContainer): :ivar container_id: ID of container. :vartype container_id: str :ivar protected_item_count: Number of protected items in the BackupEngine. - :vartype protected_item_count: long + :vartype protected_item_count: int :ivar dpm_agent_version: Backup engine Agent version. :vartype dpm_agent_version: str :ivar dpm_servers: List of BackupEngines protecting the container. @@ -223,35 +229,33 @@ class DpmContainer(ProtectionContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'can_re_register': {'key': 'canReRegister', 'type': 'bool'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'long'}, - 'dpm_agent_version': {'key': 'dpmAgentVersion', 'type': 'str'}, - 'dpm_servers': {'key': 'dpmServers', 'type': '[str]'}, - 'upgrade_available': {'key': 'upgradeAvailable', 'type': 'bool'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'DPMContainerExtendedInfo'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "can_re_register": {"key": "canReRegister", "type": "bool"}, + "container_id": {"key": "containerId", "type": "str"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "dpm_agent_version": {"key": "dpmAgentVersion", "type": "str"}, + "dpm_servers": {"key": "dpmServers", "type": "[str]"}, + "upgrade_available": {"key": "upgradeAvailable", "type": "bool"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "DPMContainerExtendedInfo"}, } - _subtype_map = { - 'container_type': {'AzureBackupServerContainer': 'AzureBackupServerContainer'} - } + _subtype_map = {"container_type": {"AzureBackupServerContainer": "AzureBackupServerContainer"}} def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -262,15 +266,15 @@ def __init__( dpm_servers: Optional[List[str]] = None, upgrade_available: Optional[bool] = None, protection_status: Optional[str] = None, - extended_info: Optional["DPMContainerExtendedInfo"] = None, + extended_info: Optional["_models.DPMContainerExtendedInfo"] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -286,7 +290,7 @@ def __init__( :keyword container_id: ID of container. :paramtype container_id: str :keyword protected_item_count: Number of protected items in the BackupEngine. - :paramtype protected_item_count: long + :paramtype protected_item_count: int :keyword dpm_agent_version: Backup engine Agent version. :paramtype dpm_agent_version: str :keyword dpm_servers: List of BackupEngines protecting the container. @@ -299,8 +303,15 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.DPMContainerExtendedInfo """ - super(DpmContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'DPMContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "DPMContainer" # type: str self.can_re_register = can_re_register self.container_id = container_id self.protected_item_count = protected_item_count @@ -311,16 +322,16 @@ def __init__( self.extended_info = extended_info -class AzureBackupServerContainer(DpmContainer): +class AzureBackupServerContainer(DpmContainer): # pylint: disable=too-many-instance-attributes """AzureBackupServer (DPMVenus) workload-specific protection container. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -328,20 +339,20 @@ class AzureBackupServerContainer(DpmContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar can_re_register: Specifies whether the container is re-registrable. @@ -349,7 +360,7 @@ class AzureBackupServerContainer(DpmContainer): :ivar container_id: ID of container. :vartype container_id: str :ivar protected_item_count: Number of protected items in the BackupEngine. - :vartype protected_item_count: long + :vartype protected_item_count: int :ivar dpm_agent_version: Backup engine Agent version. :vartype dpm_agent_version: str :ivar dpm_servers: List of BackupEngines protecting the container. @@ -364,31 +375,31 @@ class AzureBackupServerContainer(DpmContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'can_re_register': {'key': 'canReRegister', 'type': 'bool'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'long'}, - 'dpm_agent_version': {'key': 'dpmAgentVersion', 'type': 'str'}, - 'dpm_servers': {'key': 'dpmServers', 'type': '[str]'}, - 'upgrade_available': {'key': 'upgradeAvailable', 'type': 'bool'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'DPMContainerExtendedInfo'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "can_re_register": {"key": "canReRegister", "type": "bool"}, + "container_id": {"key": "containerId", "type": "str"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "dpm_agent_version": {"key": "dpmAgentVersion", "type": "str"}, + "dpm_servers": {"key": "dpmServers", "type": "[str]"}, + "upgrade_available": {"key": "upgradeAvailable", "type": "bool"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "DPMContainerExtendedInfo"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -399,15 +410,15 @@ def __init__( dpm_servers: Optional[List[str]] = None, upgrade_available: Optional[bool] = None, protection_status: Optional[str] = None, - extended_info: Optional["DPMContainerExtendedInfo"] = None, + extended_info: Optional["_models.DPMContainerExtendedInfo"] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -423,7 +434,7 @@ def __init__( :keyword container_id: ID of container. :paramtype container_id: str :keyword protected_item_count: Number of protected items in the BackupEngine. - :paramtype protected_item_count: long + :paramtype protected_item_count: int :keyword dpm_agent_version: Backup engine Agent version. :paramtype dpm_agent_version: str :keyword dpm_servers: List of BackupEngines protecting the container. @@ -436,23 +447,38 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.DPMContainerExtendedInfo """ - super(AzureBackupServerContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, can_re_register=can_re_register, container_id=container_id, protected_item_count=protected_item_count, dpm_agent_version=dpm_agent_version, dpm_servers=dpm_servers, upgrade_available=upgrade_available, protection_status=protection_status, extended_info=extended_info, **kwargs) - self.container_type = 'AzureBackupServerContainer' # type: str - - -class BackupEngineBase(msrest.serialization.Model): + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + can_re_register=can_re_register, + container_id=container_id, + protected_item_count=protected_item_count, + dpm_agent_version=dpm_agent_version, + dpm_servers=dpm_servers, + upgrade_available=upgrade_available, + protection_status=protection_status, + extended_info=extended_info, + **kwargs + ) + self.container_type = "AzureBackupServerContainer" # type: str + + +class BackupEngineBase(_serialization.Model): # pylint: disable=too-many-instance-attributes """The base backup engine class. All workload specific backup engines derive from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureBackupServerEngine, DpmBackupEngine. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupServerEngine, DpmBackupEngine All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the backup engine. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the backup engine. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Registration status of the backup engine with the Recovery Services @@ -463,8 +489,8 @@ class BackupEngineBase(msrest.serialization.Model): :vartype backup_engine_state: str :ivar health_status: Backup status of the backup engine. :vartype health_status: str - :ivar backup_engine_type: Required. Type of the backup engine.Constant filled by server. - Possible values include: "Invalid", "DpmBackupEngine", "AzureBackupServerEngine". + :ivar backup_engine_type: Type of the backup engine. Required. Known values are: "Invalid", + "DpmBackupEngine", and "AzureBackupServerEngine". :vartype backup_engine_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineType :ivar can_re_register: Flag indicating if the backup engine be registered, once already @@ -486,34 +512,37 @@ class BackupEngineBase(msrest.serialization.Model): """ _validation = { - 'backup_engine_type': {'required': True}, + "backup_engine_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'backup_engine_state': {'key': 'backupEngineState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'backup_engine_type': {'key': 'backupEngineType', 'type': 'str'}, - 'can_re_register': {'key': 'canReRegister', 'type': 'bool'}, - 'backup_engine_id': {'key': 'backupEngineId', 'type': 'str'}, - 'dpm_version': {'key': 'dpmVersion', 'type': 'str'}, - 'azure_backup_agent_version': {'key': 'azureBackupAgentVersion', 'type': 'str'}, - 'is_azure_backup_agent_upgrade_available': {'key': 'isAzureBackupAgentUpgradeAvailable', 'type': 'bool'}, - 'is_dpm_upgrade_available': {'key': 'isDpmUpgradeAvailable', 'type': 'bool'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'BackupEngineExtendedInfo'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "backup_engine_state": {"key": "backupEngineState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "backup_engine_type": {"key": "backupEngineType", "type": "str"}, + "can_re_register": {"key": "canReRegister", "type": "bool"}, + "backup_engine_id": {"key": "backupEngineId", "type": "str"}, + "dpm_version": {"key": "dpmVersion", "type": "str"}, + "azure_backup_agent_version": {"key": "azureBackupAgentVersion", "type": "str"}, + "is_azure_backup_agent_upgrade_available": {"key": "isAzureBackupAgentUpgradeAvailable", "type": "bool"}, + "is_dpm_upgrade_available": {"key": "isDpmUpgradeAvailable", "type": "bool"}, + "extended_info": {"key": "extendedInfo", "type": "BackupEngineExtendedInfo"}, } _subtype_map = { - 'backup_engine_type': {'AzureBackupServerEngine': 'AzureBackupServerEngine', 'DpmBackupEngine': 'DpmBackupEngine'} + "backup_engine_type": { + "AzureBackupServerEngine": "AzureBackupServerEngine", + "DpmBackupEngine": "DpmBackupEngine", + } } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, backup_engine_state: Optional[str] = None, health_status: Optional[str] = None, @@ -523,15 +552,15 @@ def __init__( azure_backup_agent_version: Optional[str] = None, is_azure_backup_agent_upgrade_available: Optional[bool] = None, is_dpm_upgrade_available: Optional[bool] = None, - extended_info: Optional["BackupEngineExtendedInfo"] = None, + extended_info: Optional["_models.BackupEngineExtendedInfo"] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the backup engine. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the backup engine. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Registration status of the backup engine with the Recovery @@ -559,7 +588,7 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineExtendedInfo """ - super(BackupEngineBase, self).__init__(**kwargs) + super().__init__(**kwargs) self.friendly_name = friendly_name self.backup_management_type = backup_management_type self.registration_status = registration_status @@ -575,16 +604,16 @@ def __init__( self.extended_info = extended_info -class AzureBackupServerEngine(BackupEngineBase): +class AzureBackupServerEngine(BackupEngineBase): # pylint: disable=too-many-instance-attributes """Backup engine type when Azure Backup Server is used to manage the backups. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the backup engine. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the backup engine. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Registration status of the backup engine with the Recovery Services @@ -595,8 +624,8 @@ class AzureBackupServerEngine(BackupEngineBase): :vartype backup_engine_state: str :ivar health_status: Backup status of the backup engine. :vartype health_status: str - :ivar backup_engine_type: Required. Type of the backup engine.Constant filled by server. - Possible values include: "Invalid", "DpmBackupEngine", "AzureBackupServerEngine". + :ivar backup_engine_type: Type of the backup engine. Required. Known values are: "Invalid", + "DpmBackupEngine", and "AzureBackupServerEngine". :vartype backup_engine_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineType :ivar can_re_register: Flag indicating if the backup engine be registered, once already @@ -618,30 +647,30 @@ class AzureBackupServerEngine(BackupEngineBase): """ _validation = { - 'backup_engine_type': {'required': True}, + "backup_engine_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'backup_engine_state': {'key': 'backupEngineState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'backup_engine_type': {'key': 'backupEngineType', 'type': 'str'}, - 'can_re_register': {'key': 'canReRegister', 'type': 'bool'}, - 'backup_engine_id': {'key': 'backupEngineId', 'type': 'str'}, - 'dpm_version': {'key': 'dpmVersion', 'type': 'str'}, - 'azure_backup_agent_version': {'key': 'azureBackupAgentVersion', 'type': 'str'}, - 'is_azure_backup_agent_upgrade_available': {'key': 'isAzureBackupAgentUpgradeAvailable', 'type': 'bool'}, - 'is_dpm_upgrade_available': {'key': 'isDpmUpgradeAvailable', 'type': 'bool'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'BackupEngineExtendedInfo'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "backup_engine_state": {"key": "backupEngineState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "backup_engine_type": {"key": "backupEngineType", "type": "str"}, + "can_re_register": {"key": "canReRegister", "type": "bool"}, + "backup_engine_id": {"key": "backupEngineId", "type": "str"}, + "dpm_version": {"key": "dpmVersion", "type": "str"}, + "azure_backup_agent_version": {"key": "azureBackupAgentVersion", "type": "str"}, + "is_azure_backup_agent_upgrade_available": {"key": "isAzureBackupAgentUpgradeAvailable", "type": "bool"}, + "is_dpm_upgrade_available": {"key": "isDpmUpgradeAvailable", "type": "bool"}, + "extended_info": {"key": "extendedInfo", "type": "BackupEngineExtendedInfo"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, backup_engine_state: Optional[str] = None, health_status: Optional[str] = None, @@ -651,15 +680,15 @@ def __init__( azure_backup_agent_version: Optional[str] = None, is_azure_backup_agent_upgrade_available: Optional[bool] = None, is_dpm_upgrade_available: Optional[bool] = None, - extended_info: Optional["BackupEngineExtendedInfo"] = None, + extended_info: Optional["_models.BackupEngineExtendedInfo"] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the backup engine. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the backup engine. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Registration status of the backup engine with the Recovery @@ -687,42 +716,56 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineExtendedInfo """ - super(AzureBackupServerEngine, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, backup_engine_state=backup_engine_state, health_status=health_status, can_re_register=can_re_register, backup_engine_id=backup_engine_id, dpm_version=dpm_version, azure_backup_agent_version=azure_backup_agent_version, is_azure_backup_agent_upgrade_available=is_azure_backup_agent_upgrade_available, is_dpm_upgrade_available=is_dpm_upgrade_available, extended_info=extended_info, **kwargs) - self.backup_engine_type = 'AzureBackupServerEngine' # type: str - - -class BackupRequest(msrest.serialization.Model): + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + backup_engine_state=backup_engine_state, + health_status=health_status, + can_re_register=can_re_register, + backup_engine_id=backup_engine_id, + dpm_version=dpm_version, + azure_backup_agent_version=azure_backup_agent_version, + is_azure_backup_agent_upgrade_available=is_azure_backup_agent_upgrade_available, + is_dpm_upgrade_available=is_dpm_upgrade_available, + extended_info=extended_info, + **kwargs + ) + self.backup_engine_type = "AzureBackupServerEngine" # type: str + + +class BackupRequest(_serialization.Model): """Base class for backup request. Workload-specific backup requests are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareBackupRequest, AzureWorkloadBackupRequest, IaasVMBackupRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareBackupRequest, AzureWorkloadBackupRequest, IaasVMBackupRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureFileShareBackupRequest': 'AzureFileShareBackupRequest', 'AzureWorkloadBackupRequest': 'AzureWorkloadBackupRequest', 'IaasVMBackupRequest': 'IaasVMBackupRequest'} + "object_type": { + "AzureFileShareBackupRequest": "AzureFileShareBackupRequest", + "AzureWorkloadBackupRequest": "AzureWorkloadBackupRequest", + "IaasVMBackupRequest": "IaasVMBackupRequest", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(BackupRequest, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -731,8 +774,8 @@ class AzureFileShareBackupRequest(BackupRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_expiry_time_in_utc: Backup copy will expire after the time specified (UTC). @@ -740,35 +783,30 @@ class AzureFileShareBackupRequest(BackupRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_expiry_time_in_utc': {'key': 'recoveryPointExpiryTimeInUTC', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_expiry_time_in_utc": {"key": "recoveryPointExpiryTimeInUTC", "type": "iso-8601"}, } - def __init__( - self, - *, - recovery_point_expiry_time_in_utc: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, recovery_point_expiry_time_in_utc: Optional[datetime.datetime] = None, **kwargs): """ :keyword recovery_point_expiry_time_in_utc: Backup copy will expire after the time specified (UTC). :paramtype recovery_point_expiry_time_in_utc: ~datetime.datetime """ - super(AzureFileShareBackupRequest, self).__init__(**kwargs) - self.object_type = 'AzureFileShareBackupRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureFileShareBackupRequest" # type: str self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc -class WorkloadProtectableItem(msrest.serialization.Model): +class WorkloadProtectableItem(_serialization.Model): """Base class for backup item. Workload-specific backup items are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareProtectableItem, AzureVmWorkloadProtectableItem, IaaSVMProtectableItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareProtectableItem, AzureVmWorkloadProtectableItem, IaaSVMProtectableItem All required parameters must be populated in order to send to Azure. @@ -776,30 +814,34 @@ class WorkloadProtectableItem(msrest.serialization.Model): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, } _subtype_map = { - 'protectable_item_type': {'AzureFileShare': 'AzureFileShareProtectableItem', 'AzureVmWorkloadProtectableItem': 'AzureVmWorkloadProtectableItem', 'IaaSVMProtectableItem': 'IaaSVMProtectableItem'} + "protectable_item_type": { + "AzureFileShare": "AzureFileShareProtectableItem", + "AzureVmWorkloadProtectableItem": "AzureVmWorkloadProtectableItem", + "IaaSVMProtectableItem": "IaaSVMProtectableItem", + } } def __init__( @@ -808,7 +850,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ @@ -818,12 +860,12 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(WorkloadProtectableItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_type = workload_type self.protectable_item_type = None # type: Optional[str] @@ -840,12 +882,12 @@ class AzureFileShareProtectableItem(WorkloadProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_container_fabric_id: Full Fabric ID of container to which this protectable item @@ -854,25 +896,25 @@ class AzureFileShareProtectableItem(WorkloadProtectableItem): :ivar parent_container_friendly_name: Friendly name of container to which this protectable item belongs. :vartype parent_container_friendly_name: str - :ivar azure_file_share_type: File Share type XSync or XSMB. Possible values include: "Invalid", - "XSMB", "XSync". + :ivar azure_file_share_type: File Share type XSync or XSMB. Known values are: "Invalid", + "XSMB", and "XSync". :vartype azure_file_share_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureFileShareType """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_container_fabric_id': {'key': 'parentContainerFabricId', 'type': 'str'}, - 'parent_container_friendly_name': {'key': 'parentContainerFriendlyName', 'type': 'str'}, - 'azure_file_share_type': {'key': 'azureFileShareType', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_container_fabric_id": {"key": "parentContainerFabricId", "type": "str"}, + "parent_container_friendly_name": {"key": "parentContainerFriendlyName", "type": "str"}, + "azure_file_share_type": {"key": "azureFileShareType", "type": "str"}, } def __init__( @@ -881,10 +923,10 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_container_fabric_id: Optional[str] = None, parent_container_friendly_name: Optional[str] = None, - azure_file_share_type: Optional[Union[str, "AzureFileShareType"]] = None, + azure_file_share_type: Optional[Union[str, "_models.AzureFileShareType"]] = None, **kwargs ): """ @@ -894,8 +936,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_container_fabric_id: Full Fabric ID of container to which this protectable item @@ -904,37 +946,46 @@ def __init__( :keyword parent_container_friendly_name: Friendly name of container to which this protectable item belongs. :paramtype parent_container_friendly_name: str - :keyword azure_file_share_type: File Share type XSync or XSMB. Possible values include: - "Invalid", "XSMB", "XSync". + :keyword azure_file_share_type: File Share type XSync or XSMB. Known values are: "Invalid", + "XSMB", and "XSync". :paramtype azure_file_share_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureFileShareType """ - super(AzureFileShareProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, **kwargs) - self.protectable_item_type = 'AzureFileShare' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + **kwargs + ) + self.protectable_item_type = "AzureFileShare" # type: str self.parent_container_fabric_id = parent_container_fabric_id self.parent_container_friendly_name = parent_container_friendly_name self.azure_file_share_type = azure_file_share_type -class ProtectedItem(msrest.serialization.Model): +class ProtectedItem(_serialization.Model): # pylint: disable=too-many-instance-attributes """Base class for backup items. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileshareProtectedItem, AzureIaaSVMProtectedItem, AzureVmWorkloadProtectedItem, DPMProtectedItem, GenericProtectedItem, MabFileFolderProtectedItem, AzureSqlProtectedItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileshareProtectedItem, AzureIaaSVMProtectedItem, AzureVmWorkloadProtectedItem, + DPMProtectedItem, GenericProtectedItem, MabFileFolderProtectedItem, AzureSqlProtectedItem + + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -949,7 +1000,7 @@ class ProtectedItem(msrest.serialization.Model): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -974,44 +1025,52 @@ class ProtectedItem(msrest.serialization.Model): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, } _subtype_map = { - 'protected_item_type': {'AzureFileShareProtectedItem': 'AzureFileshareProtectedItem', 'AzureIaaSVMProtectedItem': 'AzureIaaSVMProtectedItem', 'AzureVmWorkloadProtectedItem': 'AzureVmWorkloadProtectedItem', 'DPMProtectedItem': 'DPMProtectedItem', 'GenericProtectedItem': 'GenericProtectedItem', 'MabFileFolderProtectedItem': 'MabFileFolderProtectedItem', 'Microsoft.Sql/servers/databases': 'AzureSqlProtectedItem'} + "protected_item_type": { + "AzureFileShareProtectedItem": "AzureFileshareProtectedItem", + "AzureIaaSVMProtectedItem": "AzureIaaSVMProtectedItem", + "AzureVmWorkloadProtectedItem": "AzureVmWorkloadProtectedItem", + "DPMProtectedItem": "DPMProtectedItem", + "GenericProtectedItem": "GenericProtectedItem", + "MabFileFolderProtectedItem": "MabFileFolderProtectedItem", + "Microsoft.Sql/servers/databases": "AzureSqlProtectedItem", + } } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -1023,17 +1082,6 @@ def __init__( **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -1046,7 +1094,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -1070,10 +1118,10 @@ def __init__( :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str """ - super(ProtectedItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.protected_item_type = None # type: Optional[str] - self.backup_management_type = backup_management_type - self.workload_type = workload_type + self.backup_management_type = None + self.workload_type = None self.container_name = container_name self.source_resource_id = source_resource_id self.policy_id = policy_id @@ -1090,22 +1138,24 @@ def __init__( self.policy_name = policy_name -class AzureFileshareProtectedItem(ProtectedItem): +class AzureFileshareProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Azure File Share workload-specific backup item. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -1120,7 +1170,7 @@ class AzureFileshareProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -1146,8 +1196,8 @@ class AzureFileshareProtectedItem(ProtectedItem): :vartype friendly_name: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. @@ -1163,47 +1213,47 @@ class AzureFileshareProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureFileshareProtectedItemExtendedInfo'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "extended_info": {"key": "extendedInfo", "type": "AzureFileshareProtectedItemExtendedInfo"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -1214,25 +1264,14 @@ def __init__( policy_name: Optional[str] = None, friendly_name: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, last_backup_status: Optional[str] = None, last_backup_time: Optional[datetime.datetime] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, - extended_info: Optional["AzureFileshareProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, + extended_info: Optional["_models.AzureFileshareProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -1245,7 +1284,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -1272,9 +1311,8 @@ def __init__( :paramtype friendly_name: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. @@ -1288,8 +1326,24 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureFileshareProtectedItemExtendedInfo """ - super(AzureFileshareProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'AzureFileShareProtectedItem' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "AzureFileShareProtectedItem" # type: str self.friendly_name = friendly_name self.protection_status = protection_status self.protection_state = protection_state @@ -1299,7 +1353,7 @@ def __init__( self.extended_info = extended_info -class AzureFileshareProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureFileshareProtectedItemExtendedInfo(_serialization.Model): """Additional information about Azure File Share backup item. Variables are only populated by the server, and will be ignored when sending a request. @@ -1319,16 +1373,16 @@ class AzureFileshareProtectedItemExtendedInfo(msrest.serialization.Model): """ _validation = { - 'resource_state': {'readonly': True}, - 'resource_state_sync_time': {'readonly': True}, + "resource_state": {"readonly": True}, + "resource_state_sync_time": {"readonly": True}, } _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'resource_state_sync_time': {'key': 'resourceStateSyncTime', 'type': 'iso-8601'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_state": {"key": "policyState", "type": "str"}, + "resource_state": {"key": "resourceState", "type": "str"}, + "resource_state_sync_time": {"key": "resourceStateSyncTime", "type": "iso-8601"}, } def __init__( @@ -1349,7 +1403,7 @@ def __init__( item. :paramtype policy_state: str """ - super(AzureFileshareProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count self.policy_state = policy_state @@ -1357,35 +1411,43 @@ def __init__( self.resource_state_sync_time = None -class ProtectionPolicy(msrest.serialization.Model): +class ProtectionPolicy(_serialization.Model): """Base class for backup policy. Workload-specific backup policies are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSVMProtectionPolicy, AzureSqlProtectionPolicy, AzureFileShareProtectionPolicy, AzureVmWorkloadProtectionPolicy, GenericProtectionPolicy, MabProtectionPolicy. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSVMProtectionPolicy, AzureSqlProtectionPolicy, AzureFileShareProtectionPolicy, + AzureVmWorkloadProtectionPolicy, GenericProtectionPolicy, MabProtectionPolicy All required parameters must be populated in order to send to Azure. :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, } _subtype_map = { - 'backup_management_type': {'AzureIaasVM': 'AzureIaaSVMProtectionPolicy', 'AzureSql': 'AzureSqlProtectionPolicy', 'AzureStorage': 'AzureFileShareProtectionPolicy', 'AzureWorkload': 'AzureVmWorkloadProtectionPolicy', 'GenericProtectionPolicy': 'GenericProtectionPolicy', 'MAB': 'MabProtectionPolicy'} + "backup_management_type": { + "AzureIaasVM": "AzureIaaSVMProtectionPolicy", + "AzureSql": "AzureSqlProtectionPolicy", + "AzureStorage": "AzureFileShareProtectionPolicy", + "AzureWorkload": "AzureVmWorkloadProtectionPolicy", + "GenericProtectionPolicy": "GenericProtectionPolicy", + "MAB": "MabProtectionPolicy", + } } def __init__( @@ -1401,7 +1463,7 @@ def __init__( :keyword resource_guard_operation_requests: ResourceGuard Operation Requests. :paramtype resource_guard_operation_requests: list[str] """ - super(ProtectionPolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.protected_items_count = protected_items_count self.backup_management_type = None # type: Optional[str] self.resource_guard_operation_requests = resource_guard_operation_requests @@ -1414,15 +1476,15 @@ class AzureFileShareProtectionPolicy(ProtectionPolicy): :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] - :ivar work_load_type: Type of workload for the backup management. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :ivar work_load_type: Type of workload for the backup management. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype work_load_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :ivar schedule_policy: Backup schedule specified as part of backup policy. @@ -1436,17 +1498,17 @@ class AzureFileShareProtectionPolicy(ProtectionPolicy): """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'work_load_type': {'key': 'workLoadType', 'type': 'str'}, - 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - 'time_zone': {'key': 'timeZone', 'type': 'str'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "work_load_type": {"key": "workLoadType", "type": "str"}, + "schedule_policy": {"key": "schedulePolicy", "type": "SchedulePolicy"}, + "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, + "time_zone": {"key": "timeZone", "type": "str"}, } def __init__( @@ -1454,9 +1516,9 @@ def __init__( *, protected_items_count: Optional[int] = None, resource_guard_operation_requests: Optional[List[str]] = None, - work_load_type: Optional[Union[str, "WorkloadType"]] = None, - schedule_policy: Optional["SchedulePolicy"] = None, - retention_policy: Optional["RetentionPolicy"] = None, + work_load_type: Optional[Union[str, "_models.WorkloadType"]] = None, + schedule_policy: Optional["_models.SchedulePolicy"] = None, + retention_policy: Optional["_models.RetentionPolicy"] = None, time_zone: Optional[str] = None, **kwargs ): @@ -1465,10 +1527,10 @@ def __init__( :paramtype protected_items_count: int :keyword resource_guard_operation_requests: ResourceGuard Operation Requests. :paramtype resource_guard_operation_requests: list[str] - :keyword work_load_type: Type of workload for the backup management. Possible values include: + :keyword work_load_type: Type of workload for the backup management. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype work_load_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :keyword schedule_policy: Backup schedule specified as part of backup policy. @@ -1481,46 +1543,49 @@ def __init__( Standard Time". :paramtype time_zone: str """ - super(AzureFileShareProtectionPolicy, self).__init__(protected_items_count=protected_items_count, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.backup_management_type = 'AzureStorage' # type: str + super().__init__( + protected_items_count=protected_items_count, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.backup_management_type = "AzureStorage" # type: str self.work_load_type = work_load_type self.schedule_policy = schedule_policy self.retention_policy = retention_policy self.time_zone = time_zone -class ILRRequest(msrest.serialization.Model): +class ILRRequest(_serialization.Model): """Parameters to Provision ILR API. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareProvisionILRRequest, IaasVMILRRegistrationRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareProvisionILRRequest, IaasVMILRRegistrationRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureFileShareProvisionILRRequest': 'AzureFileShareProvisionILRRequest', 'IaasVMILRRegistrationRequest': 'IaasVMILRRegistrationRequest'} + "object_type": { + "AzureFileShareProvisionILRRequest": "AzureFileShareProvisionILRRequest", + "IaasVMILRRegistrationRequest": "IaasVMILRRegistrationRequest", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(ILRRequest, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -1529,8 +1594,8 @@ class AzureFileShareProvisionILRRequest(ILRRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_id: Recovery point ID. :vartype recovery_point_id: str @@ -1539,66 +1604,62 @@ class AzureFileShareProvisionILRRequest(ILRRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, } - def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - source_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, recovery_point_id: Optional[str] = None, source_resource_id: Optional[str] = None, **kwargs): """ :keyword recovery_point_id: Recovery point ID. :paramtype recovery_point_id: str :keyword source_resource_id: Source Storage account ARM Id. :paramtype source_resource_id: str """ - super(AzureFileShareProvisionILRRequest, self).__init__(**kwargs) - self.object_type = 'AzureFileShareProvisionILRRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureFileShareProvisionILRRequest" # type: str self.recovery_point_id = recovery_point_id self.source_resource_id = source_resource_id -class RecoveryPoint(msrest.serialization.Model): +class RecoveryPoint(_serialization.Model): """Base class for backup copies. Workload-specific backup copies are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareRecoveryPoint, AzureWorkloadRecoveryPoint, GenericRecoveryPoint, IaasVMRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareRecoveryPoint, AzureWorkloadRecoveryPoint, GenericRecoveryPoint, + IaasVMRecoveryPoint All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureFileShareRecoveryPoint': 'AzureFileShareRecoveryPoint', 'AzureWorkloadRecoveryPoint': 'AzureWorkloadRecoveryPoint', 'GenericRecoveryPoint': 'GenericRecoveryPoint', 'IaasVMRecoveryPoint': 'IaasVMRecoveryPoint'} + "object_type": { + "AzureFileShareRecoveryPoint": "AzureFileShareRecoveryPoint", + "AzureWorkloadRecoveryPoint": "AzureWorkloadRecoveryPoint", + "GenericRecoveryPoint": "GenericRecoveryPoint", + "IaasVMRecoveryPoint": "IaasVMRecoveryPoint", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(RecoveryPoint, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -1607,8 +1668,8 @@ class AzureFileShareRecoveryPoint(RecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_type: Type of the backup copy. Specifies whether it is a crash consistent backup or app consistent. @@ -1622,15 +1683,15 @@ class AzureFileShareRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'file_share_snapshot_uri': {'key': 'fileShareSnapshotUri', 'type': 'str'}, - 'recovery_point_size_in_gb': {'key': 'recoveryPointSizeInGB', 'type': 'int'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "file_share_snapshot_uri": {"key": "fileShareSnapshotUri", "type": "str"}, + "recovery_point_size_in_gb": {"key": "recoveryPointSizeInGB", "type": "int"}, } def __init__( @@ -1653,46 +1714,46 @@ def __init__( :keyword recovery_point_size_in_gb: Contains recovery point size. :paramtype recovery_point_size_in_gb: int """ - super(AzureFileShareRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'AzureFileShareRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "AzureFileShareRecoveryPoint" # type: str self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time self.file_share_snapshot_uri = file_share_snapshot_uri self.recovery_point_size_in_gb = recovery_point_size_in_gb -class RestoreRequest(msrest.serialization.Model): +class RestoreRequest(_serialization.Model): """Base class for restore request. Workload-specific restore requests are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareRestoreRequest, AzureWorkloadRestoreRequest, IaasVMRestoreRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareRestoreRequest, AzureWorkloadRestoreRequest, IaasVMRestoreRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureFileShareRestoreRequest': 'AzureFileShareRestoreRequest', 'AzureWorkloadRestoreRequest': 'AzureWorkloadRestoreRequest', 'IaasVMRestoreRequest': 'IaasVMRestoreRequest'} + "object_type": { + "AzureFileShareRestoreRequest": "AzureFileShareRestoreRequest", + "AzureWorkloadRestoreRequest": "AzureWorkloadRestoreRequest", + "IaasVMRestoreRequest": "IaasVMRestoreRequest", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(RestoreRequest, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -1701,20 +1762,20 @@ class AzureFileShareRestoreRequest(RestoreRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Source storage account ARM Id. :vartype source_resource_id: str - :ivar copy_options: Options to resolve copy conflicts. Possible values include: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + :ivar copy_options: Options to resolve copy conflicts. Known values are: "Invalid", + "CreateCopy", "Skip", "Overwrite", and "FailOnConflict". :vartype copy_options: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CopyOptions - :ivar restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Possible - values include: "Invalid", "FullShareRestore", "ItemLevelRestore". + :ivar restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Known values + are: "Invalid", "FullShareRestore", and "ItemLevelRestore". :vartype restore_request_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequestType :ivar restore_file_specs: List of Source Files/Folders(which need to recover) and @@ -1727,43 +1788,43 @@ class AzureFileShareRestoreRequest(RestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'copy_options': {'key': 'copyOptions', 'type': 'str'}, - 'restore_request_type': {'key': 'restoreRequestType', 'type': 'str'}, - 'restore_file_specs': {'key': 'restoreFileSpecs', 'type': '[RestoreFileSpecs]'}, - 'target_details': {'key': 'targetDetails', 'type': 'TargetAFSRestoreInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "copy_options": {"key": "copyOptions", "type": "str"}, + "restore_request_type": {"key": "restoreRequestType", "type": "str"}, + "restore_file_specs": {"key": "restoreFileSpecs", "type": "[RestoreFileSpecs]"}, + "target_details": {"key": "targetDetails", "type": "TargetAFSRestoreInfo"}, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, - copy_options: Optional[Union[str, "CopyOptions"]] = None, - restore_request_type: Optional[Union[str, "RestoreRequestType"]] = None, - restore_file_specs: Optional[List["RestoreFileSpecs"]] = None, - target_details: Optional["TargetAFSRestoreInfo"] = None, + copy_options: Optional[Union[str, "_models.CopyOptions"]] = None, + restore_request_type: Optional[Union[str, "_models.RestoreRequestType"]] = None, + restore_file_specs: Optional[List["_models.RestoreFileSpecs"]] = None, + target_details: Optional["_models.TargetAFSRestoreInfo"] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Source storage account ARM Id. :paramtype source_resource_id: str - :keyword copy_options: Options to resolve copy conflicts. Possible values include: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + :keyword copy_options: Options to resolve copy conflicts. Known values are: "Invalid", + "CreateCopy", "Skip", "Overwrite", and "FailOnConflict". :paramtype copy_options: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CopyOptions - :keyword restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Possible - values include: "Invalid", "FullShareRestore", "ItemLevelRestore". + :keyword restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Known + values are: "Invalid", "FullShareRestore", and "ItemLevelRestore". :paramtype restore_request_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequestType :keyword restore_file_specs: List of Source Files/Folders(which need to recover) and @@ -1774,8 +1835,8 @@ def __init__( :paramtype target_details: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetAFSRestoreInfo """ - super(AzureFileShareRestoreRequest, self).__init__(**kwargs) - self.object_type = 'AzureFileShareRestoreRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureFileShareRestoreRequest" # type: str self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.copy_options = copy_options @@ -1787,16 +1848,16 @@ def __init__( class IaaSVMContainer(ProtectionContainer): """IaaS VM workload-specific container. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSClassicComputeVMContainer, AzureIaaSComputeVMContainer. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSClassicComputeVMContainer, AzureIaaSComputeVMContainer All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -1804,20 +1865,20 @@ class IaaSVMContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar virtual_machine_id: Fully qualified ARM url of the virtual machine represented by this @@ -1831,30 +1892,33 @@ class IaaSVMContainer(ProtectionContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, } _subtype_map = { - 'container_type': {'Microsoft.ClassicCompute/virtualMachines': 'AzureIaaSClassicComputeVMContainer', 'Microsoft.Compute/virtualMachines': 'AzureIaaSComputeVMContainer'} + "container_type": { + "Microsoft.ClassicCompute/virtualMachines": "AzureIaaSClassicComputeVMContainer", + "Microsoft.Compute/virtualMachines": "AzureIaaSComputeVMContainer", + } } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -1866,9 +1930,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -1888,8 +1952,15 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str """ - super(IaaSVMContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'IaasVMContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "IaasVMContainer" # type: str self.virtual_machine_id = virtual_machine_id self.virtual_machine_version = virtual_machine_version self.resource_group = resource_group @@ -1902,9 +1973,9 @@ class AzureIaaSClassicComputeVMContainer(IaaSVMContainer): :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -1912,20 +1983,20 @@ class AzureIaaSClassicComputeVMContainer(IaaSVMContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar virtual_machine_id: Fully qualified ARM url of the virtual machine represented by this @@ -1939,26 +2010,26 @@ class AzureIaaSClassicComputeVMContainer(IaaSVMContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -1970,9 +2041,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -1992,15 +2063,25 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str """ - super(AzureIaaSClassicComputeVMContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, virtual_machine_id=virtual_machine_id, virtual_machine_version=virtual_machine_version, resource_group=resource_group, **kwargs) - self.container_type = 'Microsoft.ClassicCompute/virtualMachines' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + virtual_machine_id=virtual_machine_id, + virtual_machine_version=virtual_machine_version, + resource_group=resource_group, + **kwargs + ) + self.container_type = "Microsoft.ClassicCompute/virtualMachines" # type: str class IaaSVMProtectableItem(WorkloadProtectableItem): """IaaS VM workload-specific backup item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSClassicComputeVMProtectableItem, AzureIaaSComputeVMProtectableItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSClassicComputeVMProtectableItem, AzureIaaSComputeVMProtectableItem All required parameters must be populated in order to send to Azure. @@ -2008,12 +2089,12 @@ class IaaSVMProtectableItem(WorkloadProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar virtual_machine_id: Fully qualified ARM ID of the virtual machine. @@ -2026,22 +2107,25 @@ class IaaSVMProtectableItem(WorkloadProtectableItem): """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, } _subtype_map = { - 'protectable_item_type': {'Microsoft.ClassicCompute/virtualMachines': 'AzureIaaSClassicComputeVMProtectableItem', 'Microsoft.Compute/virtualMachines': 'AzureIaaSComputeVMProtectableItem'} + "protectable_item_type": { + "Microsoft.ClassicCompute/virtualMachines": "AzureIaaSClassicComputeVMProtectableItem", + "Microsoft.Compute/virtualMachines": "AzureIaaSComputeVMProtectableItem", + } } def __init__( @@ -2050,7 +2134,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, virtual_machine_id: Optional[str] = None, virtual_machine_version: Optional[str] = None, resource_group: Optional[str] = None, @@ -2063,8 +2147,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword virtual_machine_id: Fully qualified ARM ID of the virtual machine. @@ -2075,8 +2159,14 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str """ - super(IaaSVMProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, **kwargs) - self.protectable_item_type = 'IaaSVMProtectableItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + **kwargs + ) + self.protectable_item_type = "IaaSVMProtectableItem" # type: str self.virtual_machine_id = virtual_machine_id self.virtual_machine_version = virtual_machine_version self.resource_group = resource_group @@ -2091,12 +2181,12 @@ class AzureIaaSClassicComputeVMProtectableItem(IaaSVMProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar virtual_machine_id: Fully qualified ARM ID of the virtual machine. @@ -2109,18 +2199,18 @@ class AzureIaaSClassicComputeVMProtectableItem(IaaSVMProtectableItem): """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, } def __init__( @@ -2129,7 +2219,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, virtual_machine_id: Optional[str] = None, virtual_machine_version: Optional[str] = None, resource_group: Optional[str] = None, @@ -2142,8 +2232,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword virtual_machine_id: Fully qualified ARM ID of the virtual machine. @@ -2154,29 +2244,40 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str """ - super(AzureIaaSClassicComputeVMProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, virtual_machine_id=virtual_machine_id, virtual_machine_version=virtual_machine_version, resource_group=resource_group, **kwargs) - self.protectable_item_type = 'Microsoft.ClassicCompute/virtualMachines' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + virtual_machine_id=virtual_machine_id, + virtual_machine_version=virtual_machine_version, + resource_group=resource_group, + **kwargs + ) + self.protectable_item_type = "Microsoft.ClassicCompute/virtualMachines" # type: str -class AzureIaaSVMProtectedItem(ProtectedItem): +class AzureIaaSVMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific backup item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSClassicComputeVMProtectedItem, AzureIaaSComputeVMProtectedItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSClassicComputeVMProtectedItem, AzureIaaSComputeVMProtectedItem + + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -2191,7 +2292,7 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -2220,12 +2321,12 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :vartype virtual_machine_id: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState - :ivar health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -2249,56 +2350,64 @@ class AzureIaaSVMProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'health_details': {'key': 'healthDetails', 'type': '[AzureIaaSVMHealthDetails]'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMProtectedItemExtendedInfo'}, - 'extended_properties': {'key': 'extendedProperties', 'type': 'ExtendedProperties'}, + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "virtual_machine_id": {"readonly": True}, + "health_status": {"readonly": True}, + "last_backup_time": {"readonly": True}, + "protected_item_data_id": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "health_details": {"key": "healthDetails", "type": "[AzureIaaSVMHealthDetails]"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMProtectedItemExtendedInfo"}, + "extended_properties": {"key": "extendedProperties", "type": "ExtendedProperties"}, } _subtype_map = { - 'protected_item_type': {'Microsoft.ClassicCompute/virtualMachines': 'AzureIaaSClassicComputeVMProtectedItem', 'Microsoft.Compute/virtualMachines': 'AzureIaaSComputeVMProtectedItem'} + "protected_item_type": { + "Microsoft.ClassicCompute/virtualMachines": "AzureIaaSClassicComputeVMProtectedItem", + "Microsoft.Compute/virtualMachines": "AzureIaaSComputeVMProtectedItem", + } } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -2307,32 +2416,16 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, - virtual_machine_id: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, - health_details: Optional[List["AzureIaaSVMHealthDetails"]] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, last_backup_status: Optional[str] = None, - last_backup_time: Optional[datetime.datetime] = None, - protected_item_data_id: Optional[str] = None, - extended_info: Optional["AzureIaaSVMProtectedItemExtendedInfo"] = None, - extended_properties: Optional["ExtendedProperties"] = None, + extended_info: Optional["_models.AzureIaaSVMProtectedItemExtendedInfo"] = None, + extended_properties: Optional["_models.ExtendedProperties"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -2345,7 +2438,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -2368,22 +2461,12 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the VM represented by this backup item. - :paramtype friendly_name: str - :keyword virtual_machine_id: Fully qualified ARM ID of the virtual machine represented by this - item. - :paramtype virtual_machine_id: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState - :keyword health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". - :paramtype health_status: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :keyword health_details: Health details on this backup item. :paramtype health_details: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMHealthDetails] @@ -2392,10 +2475,6 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] :keyword last_backup_status: Last backup operation status. :paramtype last_backup_status: str - :keyword last_backup_time: Timestamp of the last backup operation on this backup item. - :paramtype last_backup_time: ~datetime.datetime - :keyword protected_item_data_id: Data ID of the protected item. - :paramtype protected_item_data_id: str :keyword extended_info: Additional information for this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMProtectedItemExtendedInfo @@ -2403,38 +2482,56 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ExtendedProperties """ - super(AzureIaaSVMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'AzureIaaSVMProtectedItem' # type: str - self.friendly_name = friendly_name - self.virtual_machine_id = virtual_machine_id + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "AzureIaaSVMProtectedItem" # type: str + self.friendly_name = None + self.virtual_machine_id = None self.protection_status = protection_status self.protection_state = protection_state - self.health_status = health_status + self.health_status = None self.health_details = health_details self.kpis_healths = kpis_healths self.last_backup_status = last_backup_status - self.last_backup_time = last_backup_time - self.protected_item_data_id = protected_item_data_id + self.last_backup_time = None + self.protected_item_data_id = None self.extended_info = extended_info self.extended_properties = extended_properties -class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): +class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific backup item representing the Classic Compute VM. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -2449,7 +2546,7 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -2478,12 +2575,12 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :vartype virtual_machine_id: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState - :ivar health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -2507,52 +2604,57 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'health_details': {'key': 'healthDetails', 'type': '[AzureIaaSVMHealthDetails]'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMProtectedItemExtendedInfo'}, - 'extended_properties': {'key': 'extendedProperties', 'type': 'ExtendedProperties'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "virtual_machine_id": {"readonly": True}, + "health_status": {"readonly": True}, + "last_backup_time": {"readonly": True}, + "protected_item_data_id": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "health_details": {"key": "healthDetails", "type": "[AzureIaaSVMHealthDetails]"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMProtectedItemExtendedInfo"}, + "extended_properties": {"key": "extendedProperties", "type": "ExtendedProperties"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -2561,32 +2663,16 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, - virtual_machine_id: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, - health_details: Optional[List["AzureIaaSVMHealthDetails"]] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, last_backup_status: Optional[str] = None, - last_backup_time: Optional[datetime.datetime] = None, - protected_item_data_id: Optional[str] = None, - extended_info: Optional["AzureIaaSVMProtectedItemExtendedInfo"] = None, - extended_properties: Optional["ExtendedProperties"] = None, + extended_info: Optional["_models.AzureIaaSVMProtectedItemExtendedInfo"] = None, + extended_properties: Optional["_models.ExtendedProperties"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -2599,7 +2685,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -2622,22 +2708,12 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the VM represented by this backup item. - :paramtype friendly_name: str - :keyword virtual_machine_id: Fully qualified ARM ID of the virtual machine represented by this - item. - :paramtype virtual_machine_id: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState - :keyword health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". - :paramtype health_status: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :keyword health_details: Health details on this backup item. :paramtype health_details: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMHealthDetails] @@ -2646,10 +2722,6 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] :keyword last_backup_status: Last backup operation status. :paramtype last_backup_status: str - :keyword last_backup_time: Timestamp of the last backup operation on this backup item. - :paramtype last_backup_time: ~datetime.datetime - :keyword protected_item_data_id: Data ID of the protected item. - :paramtype protected_item_data_id: str :keyword extended_info: Additional information for this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMProtectedItemExtendedInfo @@ -2657,8 +2729,31 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ExtendedProperties """ - super(AzureIaaSClassicComputeVMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, friendly_name=friendly_name, virtual_machine_id=virtual_machine_id, protection_status=protection_status, protection_state=protection_state, health_status=health_status, health_details=health_details, kpis_healths=kpis_healths, last_backup_status=last_backup_status, last_backup_time=last_backup_time, protected_item_data_id=protected_item_data_id, extended_info=extended_info, extended_properties=extended_properties, **kwargs) - self.protected_item_type = 'Microsoft.ClassicCompute/virtualMachines' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + protection_status=protection_status, + protection_state=protection_state, + health_details=health_details, + kpis_healths=kpis_healths, + last_backup_status=last_backup_status, + extended_info=extended_info, + extended_properties=extended_properties, + **kwargs + ) + self.protected_item_type = "Microsoft.ClassicCompute/virtualMachines" # type: str class AzureIaaSComputeVMContainer(IaaSVMContainer): @@ -2668,9 +2763,9 @@ class AzureIaaSComputeVMContainer(IaaSVMContainer): :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -2678,20 +2773,20 @@ class AzureIaaSComputeVMContainer(IaaSVMContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar virtual_machine_id: Fully qualified ARM url of the virtual machine represented by this @@ -2705,26 +2800,26 @@ class AzureIaaSComputeVMContainer(IaaSVMContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -2736,9 +2831,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -2758,8 +2853,18 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str """ - super(AzureIaaSComputeVMContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, virtual_machine_id=virtual_machine_id, virtual_machine_version=virtual_machine_version, resource_group=resource_group, **kwargs) - self.container_type = 'Microsoft.Compute/virtualMachines' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + virtual_machine_id=virtual_machine_id, + virtual_machine_version=virtual_machine_version, + resource_group=resource_group, + **kwargs + ) + self.container_type = "Microsoft.Compute/virtualMachines" # type: str class AzureIaaSComputeVMProtectableItem(IaaSVMProtectableItem): @@ -2771,12 +2876,12 @@ class AzureIaaSComputeVMProtectableItem(IaaSVMProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar virtual_machine_id: Fully qualified ARM ID of the virtual machine. @@ -2789,18 +2894,18 @@ class AzureIaaSComputeVMProtectableItem(IaaSVMProtectableItem): """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, } def __init__( @@ -2809,7 +2914,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, virtual_machine_id: Optional[str] = None, virtual_machine_version: Optional[str] = None, resource_group: Optional[str] = None, @@ -2822,8 +2927,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword virtual_machine_id: Fully qualified ARM ID of the virtual machine. @@ -2834,26 +2939,37 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str """ - super(AzureIaaSComputeVMProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, virtual_machine_id=virtual_machine_id, virtual_machine_version=virtual_machine_version, resource_group=resource_group, **kwargs) - self.protectable_item_type = 'Microsoft.Compute/virtualMachines' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + virtual_machine_id=virtual_machine_id, + virtual_machine_version=virtual_machine_version, + resource_group=resource_group, + **kwargs + ) + self.protectable_item_type = "Microsoft.Compute/virtualMachines" # type: str -class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): +class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific backup item representing the Azure Resource Manager VM. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -2868,7 +2984,7 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -2897,12 +3013,12 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :vartype virtual_machine_id: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState - :ivar health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -2926,52 +3042,57 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'health_details': {'key': 'healthDetails', 'type': '[AzureIaaSVMHealthDetails]'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMProtectedItemExtendedInfo'}, - 'extended_properties': {'key': 'extendedProperties', 'type': 'ExtendedProperties'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "virtual_machine_id": {"readonly": True}, + "health_status": {"readonly": True}, + "last_backup_time": {"readonly": True}, + "protected_item_data_id": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "health_details": {"key": "healthDetails", "type": "[AzureIaaSVMHealthDetails]"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMProtectedItemExtendedInfo"}, + "extended_properties": {"key": "extendedProperties", "type": "ExtendedProperties"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -2980,32 +3101,16 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, - virtual_machine_id: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, - health_details: Optional[List["AzureIaaSVMHealthDetails"]] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, last_backup_status: Optional[str] = None, - last_backup_time: Optional[datetime.datetime] = None, - protected_item_data_id: Optional[str] = None, - extended_info: Optional["AzureIaaSVMProtectedItemExtendedInfo"] = None, - extended_properties: Optional["ExtendedProperties"] = None, + extended_info: Optional["_models.AzureIaaSVMProtectedItemExtendedInfo"] = None, + extended_properties: Optional["_models.ExtendedProperties"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -3018,7 +3123,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -3041,22 +3146,12 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the VM represented by this backup item. - :paramtype friendly_name: str - :keyword virtual_machine_id: Fully qualified ARM ID of the virtual machine represented by this - item. - :paramtype virtual_machine_id: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState - :keyword health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". - :paramtype health_status: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :keyword health_details: Health details on this backup item. :paramtype health_details: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMHealthDetails] @@ -3065,10 +3160,6 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] :keyword last_backup_status: Last backup operation status. :paramtype last_backup_status: str - :keyword last_backup_time: Timestamp of the last backup operation on this backup item. - :paramtype last_backup_time: ~datetime.datetime - :keyword protected_item_data_id: Data ID of the protected item. - :paramtype protected_item_data_id: str :keyword extended_info: Additional information for this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMProtectedItemExtendedInfo @@ -3076,11 +3167,34 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ExtendedProperties """ - super(AzureIaaSComputeVMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, friendly_name=friendly_name, virtual_machine_id=virtual_machine_id, protection_status=protection_status, protection_state=protection_state, health_status=health_status, health_details=health_details, kpis_healths=kpis_healths, last_backup_status=last_backup_status, last_backup_time=last_backup_time, protected_item_data_id=protected_item_data_id, extended_info=extended_info, extended_properties=extended_properties, **kwargs) - self.protected_item_type = 'Microsoft.Compute/virtualMachines' # type: str - - -class AzureIaaSVMErrorInfo(msrest.serialization.Model): + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + protection_status=protection_status, + protection_state=protection_state, + health_details=health_details, + kpis_healths=kpis_healths, + last_backup_status=last_backup_status, + extended_info=extended_info, + extended_properties=extended_properties, + **kwargs + ) + self.protected_item_type = "Microsoft.Compute/virtualMachines" # type: str + + +class AzureIaaSVMErrorInfo(_serialization.Model): """Azure IaaS VM workload-specific error information. Variables are only populated by the server, and will be ignored when sending a request. @@ -3096,33 +3210,29 @@ class AzureIaaSVMErrorInfo(msrest.serialization.Model): """ _validation = { - 'error_code': {'readonly': True}, - 'error_title': {'readonly': True}, - 'error_string': {'readonly': True}, - 'recommendations': {'readonly': True}, + "error_code": {"readonly": True}, + "error_title": {"readonly": True}, + "error_string": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_title': {'key': 'errorTitle', 'type': 'str'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_title": {"key": "errorTitle", "type": "str"}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureIaaSVMErrorInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error_code = None self.error_title = None self.error_string = None self.recommendations = None -class ResourceHealthDetails(msrest.serialization.Model): +class ResourceHealthDetails(_serialization.Model): """Health Details for backup items. Variables are only populated by the server, and will be ignored when sending a request. @@ -3138,26 +3248,22 @@ class ResourceHealthDetails(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'title': {'readonly': True}, - 'message': {'readonly': True}, - 'recommendations': {'readonly': True}, + "code": {"readonly": True}, + "title": {"readonly": True}, + "message": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'int'}, - 'title': {'key': 'title', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "int"}, + "title": {"key": "title", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ResourceHealthDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.title = None self.message = None @@ -3180,41 +3286,37 @@ class AzureIaaSVMHealthDetails(ResourceHealthDetails): """ _validation = { - 'code': {'readonly': True}, - 'title': {'readonly': True}, - 'message': {'readonly': True}, - 'recommendations': {'readonly': True}, + "code": {"readonly": True}, + "title": {"readonly": True}, + "message": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'int'}, - 'title': {'key': 'title', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "int"}, + "title": {"key": "title", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureIaaSVMHealthDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) -class Job(msrest.serialization.Model): +class Job(_serialization.Model): """Defines workload agnostic properties for a job. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSVMJob, AzureIaaSVMJobV2, AzureStorageJob, AzureWorkloadJob, DpmJob, MabJob, VaultJob. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSVMJob, AzureIaaSVMJobV2, AzureStorageJob, AzureWorkloadJob, DpmJob, MabJob, VaultJob All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -3227,35 +3329,43 @@ class Job(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, } _subtype_map = { - 'job_type': {'AzureIaaSVMJob': 'AzureIaaSVMJob', 'AzureIaaSVMJobV2': 'AzureIaaSVMJobV2', 'AzureStorageJob': 'AzureStorageJob', 'AzureWorkloadJob': 'AzureWorkloadJob', 'DpmJob': 'DpmJob', 'MabJob': 'MabJob', 'VaultJob': 'VaultJob'} + "job_type": { + "AzureIaaSVMJob": "AzureIaaSVMJob", + "AzureIaaSVMJobV2": "AzureIaaSVMJobV2", + "AzureStorageJob": "AzureStorageJob", + "AzureWorkloadJob": "AzureWorkloadJob", + "DpmJob": "DpmJob", + "MabJob": "MabJob", + "VaultJob": "VaultJob", + } } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, @@ -3267,9 +3377,9 @@ def __init__( :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3283,7 +3393,7 @@ def __init__( :keyword activity_id: ActivityId of job. :paramtype activity_id: str """ - super(Job, self).__init__(**kwargs) + super().__init__(**kwargs) self.entity_friendly_name = entity_friendly_name self.backup_management_type = backup_management_type self.operation = operation @@ -3294,16 +3404,16 @@ def __init__( self.job_type = None # type: Optional[str] -class AzureIaaSVMJob(Job): +class AzureIaaSVMJob(Job): # pylint: disable=too-many-instance-attributes """Azure IaaS VM workload-specific job object. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -3316,8 +3426,8 @@ class AzureIaaSVMJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed during the execution of this job. :vartype duration: ~datetime.timedelta @@ -3340,42 +3450,42 @@ class AzureIaaSVMJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureIaaSVMErrorInfo]'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMJobExtendedInfo'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'is_user_triggered': {'key': 'isUserTriggered', 'type': 'bool'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[AzureIaaSVMErrorInfo]"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMJobExtendedInfo"}, + "container_name": {"key": "containerName", "type": "str"}, + "is_user_triggered": {"key": "isUserTriggered", "type": "bool"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["AzureIaaSVMErrorInfo"]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.AzureIaaSVMErrorInfo"]] = None, virtual_machine_version: Optional[str] = None, - extended_info: Optional["AzureIaaSVMJobExtendedInfo"] = None, + extended_info: Optional["_models.AzureIaaSVMJobExtendedInfo"] = None, container_name: Optional[str] = None, is_user_triggered: Optional[bool] = None, **kwargs @@ -3384,9 +3494,9 @@ def __init__( :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3418,8 +3528,17 @@ def __init__( :keyword is_user_triggered: Indicated that whether the job is adhoc(true) or scheduled(false). :paramtype is_user_triggered: bool """ - super(AzureIaaSVMJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureIaaSVMJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureIaaSVMJob" # type: str self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -3429,7 +3548,7 @@ def __init__( self.is_user_triggered = is_user_triggered -class AzureIaaSVMJobExtendedInfo(msrest.serialization.Model): +class AzureIaaSVMJobExtendedInfo(_serialization.Model): """Azure IaaS VM workload-specific additional information for job. :ivar tasks_list: List of tasks associated with this job. @@ -3449,18 +3568,18 @@ class AzureIaaSVMJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[AzureIaaSVMJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'internal_property_bag': {'key': 'internalPropertyBag', 'type': '{str}'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'float'}, - 'estimated_remaining_duration': {'key': 'estimatedRemainingDuration', 'type': 'str'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[AzureIaaSVMJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "internal_property_bag": {"key": "internalPropertyBag", "type": "{str}"}, + "progress_percentage": {"key": "progressPercentage", "type": "float"}, + "estimated_remaining_duration": {"key": "estimatedRemainingDuration", "type": "str"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["AzureIaaSVMJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.AzureIaaSVMJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, internal_property_bag: Optional[Dict[str, str]] = None, progress_percentage: Optional[float] = None, @@ -3484,7 +3603,7 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(AzureIaaSVMJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.internal_property_bag = internal_property_bag @@ -3493,7 +3612,7 @@ def __init__( self.dynamic_error_message = dynamic_error_message -class AzureIaaSVMJobTaskDetails(msrest.serialization.Model): +class AzureIaaSVMJobTaskDetails(_serialization.Model): """Azure IaaS VM workload-specific job task details. :ivar task_id: The task display name. @@ -3516,14 +3635,14 @@ class AzureIaaSVMJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'instance_id': {'key': 'instanceId', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'status': {'key': 'status', 'type': 'str'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'float'}, - 'task_execution_details': {'key': 'taskExecutionDetails', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "instance_id": {"key": "instanceId", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "status": {"key": "status", "type": "str"}, + "progress_percentage": {"key": "progressPercentage", "type": "float"}, + "task_execution_details": {"key": "taskExecutionDetails", "type": "str"}, } def __init__( @@ -3558,7 +3677,7 @@ def __init__( eg: number of bytes transferred etc. :paramtype task_execution_details: str """ - super(AzureIaaSVMJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.start_time = start_time self.end_time = end_time @@ -3569,16 +3688,16 @@ def __init__( self.task_execution_details = task_execution_details -class AzureIaaSVMJobV2(Job): +class AzureIaaSVMJobV2(Job): # pylint: disable=too-many-instance-attributes """Azure IaaS VM workload-specific job object. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -3591,8 +3710,8 @@ class AzureIaaSVMJobV2(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar actions_info: Gets or sets the state/actions applicable on this job like cancel/retry. :vartype actions_info: list[str or @@ -3613,51 +3732,51 @@ class AzureIaaSVMJobV2(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureIaaSVMErrorInfo]'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "container_name": {"key": "containerName", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "error_details": {"key": "errorDetails", "type": "[AzureIaaSVMErrorInfo]"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, container_name: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - error_details: Optional[List["AzureIaaSVMErrorInfo"]] = None, + error_details: Optional[List["_models.AzureIaaSVMErrorInfo"]] = None, virtual_machine_version: Optional[str] = None, - extended_info: Optional["AzureIaaSVMJobExtendedInfo"] = None, + extended_info: Optional["_models.AzureIaaSVMJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3687,8 +3806,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureIaaSVMJobExtendedInfo """ - super(AzureIaaSVMJobV2, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureIaaSVMJobV2' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureIaaSVMJobV2" # type: str self.actions_info = actions_info self.container_name = container_name self.duration = duration @@ -3697,11 +3825,21 @@ def __init__( self.extended_info = extended_info -class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureIaaSVMProtectedItemExtendedInfo(_serialization.Model): """Additional information on Azure IaaS VM specific backup item. - :ivar oldest_recovery_point: The oldest backup copy available for this backup item. + :ivar oldest_recovery_point: The oldest backup copy available for this backup item across all + tiers. :vartype oldest_recovery_point: ~datetime.datetime + :ivar oldest_recovery_point_in_vault: The oldest backup copy available for this backup item in + vault tier. + :vartype oldest_recovery_point_in_vault: ~datetime.datetime + :ivar oldest_recovery_point_in_archive: The oldest backup copy available for this backup item + in archive tier. + :vartype oldest_recovery_point_in_archive: ~datetime.datetime + :ivar newest_recovery_point_in_archive: The latest backup copy available for this backup item + in archive tier. + :vartype newest_recovery_point_in_archive: ~datetime.datetime :ivar recovery_point_count: Number of backup copies available for this backup item. :vartype recovery_point_count: int :ivar policy_inconsistent: Specifies if backup policy associated with the backup item is @@ -3710,30 +3848,49 @@ class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_inconsistent': {'key': 'policyInconsistent', 'type': 'bool'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "oldest_recovery_point_in_vault": {"key": "oldestRecoveryPointInVault", "type": "iso-8601"}, + "oldest_recovery_point_in_archive": {"key": "oldestRecoveryPointInArchive", "type": "iso-8601"}, + "newest_recovery_point_in_archive": {"key": "newestRecoveryPointInArchive", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_inconsistent": {"key": "policyInconsistent", "type": "bool"}, } def __init__( self, *, oldest_recovery_point: Optional[datetime.datetime] = None, + oldest_recovery_point_in_vault: Optional[datetime.datetime] = None, + oldest_recovery_point_in_archive: Optional[datetime.datetime] = None, + newest_recovery_point_in_archive: Optional[datetime.datetime] = None, recovery_point_count: Optional[int] = None, policy_inconsistent: Optional[bool] = None, **kwargs ): """ - :keyword oldest_recovery_point: The oldest backup copy available for this backup item. + :keyword oldest_recovery_point: The oldest backup copy available for this backup item across + all tiers. :paramtype oldest_recovery_point: ~datetime.datetime + :keyword oldest_recovery_point_in_vault: The oldest backup copy available for this backup item + in vault tier. + :paramtype oldest_recovery_point_in_vault: ~datetime.datetime + :keyword oldest_recovery_point_in_archive: The oldest backup copy available for this backup + item in archive tier. + :paramtype oldest_recovery_point_in_archive: ~datetime.datetime + :keyword newest_recovery_point_in_archive: The latest backup copy available for this backup + item in archive tier. + :paramtype newest_recovery_point_in_archive: ~datetime.datetime :keyword recovery_point_count: Number of backup copies available for this backup item. :paramtype recovery_point_count: int :keyword policy_inconsistent: Specifies if backup policy associated with the backup item is inconsistent. :paramtype policy_inconsistent: bool """ - super(AzureIaaSVMProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point + self.oldest_recovery_point_in_vault = oldest_recovery_point_in_vault + self.oldest_recovery_point_in_archive = oldest_recovery_point_in_archive + self.newest_recovery_point_in_archive = newest_recovery_point_in_archive self.recovery_point_count = recovery_point_count self.policy_inconsistent = policy_inconsistent @@ -3745,8 +3902,8 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] @@ -3758,30 +3915,36 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): :ivar retention_policy: Retention policy with the details on backup copy retention ranges. :vartype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :ivar tiering_policy: Tiering policy to automatically move RPs to another tier + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :vartype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] :ivar instant_rp_retention_range_in_days: Instant RP retention policy range in days. :vartype instant_rp_retention_range_in_days: int :ivar time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". :vartype time_zone: str - :ivar policy_type: Possible values include: "Invalid", "V1", "V2". + :ivar policy_type: Known values are: "Invalid", "V1", and "V2". :vartype policy_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.IAASVMPolicyType """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'instant_rp_details': {'key': 'instantRPDetails', 'type': 'InstantRPAdditionalDetails'}, - 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - 'instant_rp_retention_range_in_days': {'key': 'instantRpRetentionRangeInDays', 'type': 'int'}, - 'time_zone': {'key': 'timeZone', 'type': 'str'}, - 'policy_type': {'key': 'policyType', 'type': 'str'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "instant_rp_details": {"key": "instantRPDetails", "type": "InstantRPAdditionalDetails"}, + "schedule_policy": {"key": "schedulePolicy", "type": "SchedulePolicy"}, + "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, + "tiering_policy": {"key": "tieringPolicy", "type": "{TieringPolicy}"}, + "instant_rp_retention_range_in_days": {"key": "instantRpRetentionRangeInDays", "type": "int"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "policy_type": {"key": "policyType", "type": "str"}, } def __init__( @@ -3789,12 +3952,13 @@ def __init__( *, protected_items_count: Optional[int] = None, resource_guard_operation_requests: Optional[List[str]] = None, - instant_rp_details: Optional["InstantRPAdditionalDetails"] = None, - schedule_policy: Optional["SchedulePolicy"] = None, - retention_policy: Optional["RetentionPolicy"] = None, + instant_rp_details: Optional["_models.InstantRPAdditionalDetails"] = None, + schedule_policy: Optional["_models.SchedulePolicy"] = None, + retention_policy: Optional["_models.RetentionPolicy"] = None, + tiering_policy: Optional[Dict[str, "_models.TieringPolicy"]] = None, instant_rp_retention_range_in_days: Optional[int] = None, time_zone: Optional[str] = None, - policy_type: Optional[Union[str, "IAASVMPolicyType"]] = None, + policy_type: Optional[Union[str, "_models.IAASVMPolicyType"]] = None, **kwargs ): """ @@ -3811,42 +3975,53 @@ def __init__( :keyword retention_policy: Retention policy with the details on backup copy retention ranges. :paramtype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :keyword tiering_policy: Tiering policy to automatically move RPs to another tier + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :paramtype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] :keyword instant_rp_retention_range_in_days: Instant RP retention policy range in days. :paramtype instant_rp_retention_range_in_days: int :keyword time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". :paramtype time_zone: str - :keyword policy_type: Possible values include: "Invalid", "V1", "V2". + :keyword policy_type: Known values are: "Invalid", "V1", and "V2". :paramtype policy_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.IAASVMPolicyType """ - super(AzureIaaSVMProtectionPolicy, self).__init__(protected_items_count=protected_items_count, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.backup_management_type = 'AzureIaasVM' # type: str + super().__init__( + protected_items_count=protected_items_count, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.backup_management_type = "AzureIaasVM" # type: str self.instant_rp_details = instant_rp_details self.schedule_policy = schedule_policy self.retention_policy = retention_policy + self.tiering_policy = tiering_policy self.instant_rp_retention_range_in_days = instant_rp_retention_range_in_days self.time_zone = time_zone self.policy_type = policy_type -class ProtectionIntent(msrest.serialization.Model): +class ProtectionIntent(_serialization.Model): """Base class for backup ProtectionIntent. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureResourceProtectionIntent, AzureWorkloadContainerAutoProtectionIntent, AzureRecoveryServiceVaultProtectionIntent. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureResourceProtectionIntent, AzureWorkloadContainerAutoProtectionIntent, + AzureRecoveryServiceVaultProtectionIntent All required parameters must be populated in order to send to Azure. - :ivar protection_intent_item_type: Required. backup protectionIntent type.Constant filled by - server. Possible values include: "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", - "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", + :ivar protection_intent_item_type: backup protectionIntent type. Required. Known values are: + "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", + "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", and "AzureWorkloadSQLAutoProtectionIntent". :vartype protection_intent_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentItemType - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar source_resource_id: ARM ID of the resource to be backed up. @@ -3856,43 +4031,47 @@ class ProtectionIntent(msrest.serialization.Model): :vartype item_id: str :ivar policy_id: ID of the backup policy with which this item is backed up. :vartype policy_id: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _validation = { - 'protection_intent_item_type': {'required': True}, + "protection_intent_item_type": {"required": True}, } _attribute_map = { - 'protection_intent_item_type': {'key': 'protectionIntentItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'item_id': {'key': 'itemId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, + "protection_intent_item_type": {"key": "protectionIntentItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "item_id": {"key": "itemId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, } _subtype_map = { - 'protection_intent_item_type': {'AzureResourceItem': 'AzureResourceProtectionIntent', 'AzureWorkloadContainerAutoProtectionIntent': 'AzureWorkloadContainerAutoProtectionIntent', 'RecoveryServiceVaultItem': 'AzureRecoveryServiceVaultProtectionIntent'} + "protection_intent_item_type": { + "AzureResourceItem": "AzureResourceProtectionIntent", + "AzureWorkloadContainerAutoProtectionIntent": "AzureWorkloadContainerAutoProtectionIntent", + "RecoveryServiceVaultItem": "AzureRecoveryServiceVaultProtectionIntent", + } } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, source_resource_id: Optional[str] = None, item_id: Optional[str] = None, policy_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -3902,12 +4081,12 @@ def __init__( :paramtype item_id: str :keyword policy_id: ID of the backup policy with which this item is backed up. :paramtype policy_id: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(ProtectionIntent, self).__init__(**kwargs) + super().__init__(**kwargs) self.protection_intent_item_type = None # type: Optional[str] self.backup_management_type = backup_management_type self.source_resource_id = source_resource_id @@ -3919,20 +4098,20 @@ def __init__( class AzureRecoveryServiceVaultProtectionIntent(ProtectionIntent): """Azure Recovery Services Vault specific protection intent item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadAutoProtectionIntent. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadAutoProtectionIntent All required parameters must be populated in order to send to Azure. - :ivar protection_intent_item_type: Required. backup protectionIntent type.Constant filled by - server. Possible values include: "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", - "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", + :ivar protection_intent_item_type: backup protectionIntent type. Required. Known values are: + "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", + "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", and "AzureWorkloadSQLAutoProtectionIntent". :vartype protection_intent_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentItemType - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar source_resource_id: ARM ID of the resource to be backed up. @@ -3942,43 +4121,43 @@ class AzureRecoveryServiceVaultProtectionIntent(ProtectionIntent): :vartype item_id: str :ivar policy_id: ID of the backup policy with which this item is backed up. :vartype policy_id: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _validation = { - 'protection_intent_item_type': {'required': True}, + "protection_intent_item_type": {"required": True}, } _attribute_map = { - 'protection_intent_item_type': {'key': 'protectionIntentItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'item_id': {'key': 'itemId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, + "protection_intent_item_type": {"key": "protectionIntentItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "item_id": {"key": "itemId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, } _subtype_map = { - 'protection_intent_item_type': {'AzureWorkloadAutoProtectionIntent': 'AzureWorkloadAutoProtectionIntent'} + "protection_intent_item_type": {"AzureWorkloadAutoProtectionIntent": "AzureWorkloadAutoProtectionIntent"} } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, source_resource_id: Optional[str] = None, item_id: Optional[str] = None, policy_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -3988,13 +4167,20 @@ def __init__( :paramtype item_id: str :keyword policy_id: ID of the backup policy with which this item is backed up. :paramtype policy_id: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(AzureRecoveryServiceVaultProtectionIntent, self).__init__(backup_management_type=backup_management_type, source_resource_id=source_resource_id, item_id=item_id, policy_id=policy_id, protection_state=protection_state, **kwargs) - self.protection_intent_item_type = 'RecoveryServiceVaultItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + source_resource_id=source_resource_id, + item_id=item_id, + policy_id=policy_id, + protection_state=protection_state, + **kwargs + ) + self.protection_intent_item_type = "RecoveryServiceVaultItem" # type: str class AzureResourceProtectionIntent(ProtectionIntent): @@ -4002,15 +4188,15 @@ class AzureResourceProtectionIntent(ProtectionIntent): All required parameters must be populated in order to send to Azure. - :ivar protection_intent_item_type: Required. backup protectionIntent type.Constant filled by - server. Possible values include: "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", - "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", + :ivar protection_intent_item_type: backup protectionIntent type. Required. Known values are: + "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", + "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", and "AzureWorkloadSQLAutoProtectionIntent". :vartype protection_intent_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentItemType - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar source_resource_id: ARM ID of the resource to be backed up. @@ -4020,8 +4206,8 @@ class AzureResourceProtectionIntent(ProtectionIntent): :vartype item_id: str :ivar policy_id: ID of the backup policy with which this item is backed up. :vartype policy_id: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar friendly_name: Friendly name of the VM represented by this backup item. @@ -4029,34 +4215,34 @@ class AzureResourceProtectionIntent(ProtectionIntent): """ _validation = { - 'protection_intent_item_type': {'required': True}, + "protection_intent_item_type": {"required": True}, } _attribute_map = { - 'protection_intent_item_type': {'key': 'protectionIntentItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'item_id': {'key': 'itemId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + "protection_intent_item_type": {"key": "protectionIntentItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "item_id": {"key": "itemId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, source_resource_id: Optional[str] = None, item_id: Optional[str] = None, policy_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, friendly_name: Optional[str] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -4066,31 +4252,38 @@ def __init__( :paramtype item_id: str :keyword policy_id: ID of the backup policy with which this item is backed up. :paramtype policy_id: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword friendly_name: Friendly name of the VM represented by this backup item. :paramtype friendly_name: str """ - super(AzureResourceProtectionIntent, self).__init__(backup_management_type=backup_management_type, source_resource_id=source_resource_id, item_id=item_id, policy_id=policy_id, protection_state=protection_state, **kwargs) - self.protection_intent_item_type = 'AzureResourceItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + source_resource_id=source_resource_id, + item_id=item_id, + policy_id=policy_id, + protection_state=protection_state, + **kwargs + ) + self.protection_intent_item_type = "AzureResourceItem" # type: str self.friendly_name = friendly_name -class AzureWorkloadContainer(ProtectionContainer): +class AzureWorkloadContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes """Container for the workloads running inside Azure Compute or Classic Compute. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureSQLAGWorkloadContainerProtectionContainer, AzureVMAppContainerProtectionContainer. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureSQLAGWorkloadContainerProtectionContainer, AzureVMAppContainerProtectionContainer All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -4098,20 +4291,20 @@ class AzureWorkloadContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar source_resource_id: ARM ID of the virtual machine represented by this Azure Workload @@ -4122,61 +4315,64 @@ class AzureWorkloadContainer(ProtectionContainer): :ivar extended_info: Additional details of a workload container. :vartype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadContainerExtendedInfo - :ivar workload_type: Workload type for which registration was sent. Possible values include: + :ivar workload_type: Workload type for which registration was sent. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar operation_type: Re-Do Operation. Possible values include: "Invalid", "Register", + :ivar operation_type: Re-Do Operation. Known values are: "Invalid", "Register", and "Reregister". :vartype operation_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationType """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadContainerExtendedInfo'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "last_updated_time": {"key": "lastUpdatedTime", "type": "iso-8601"}, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadContainerExtendedInfo"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "operation_type": {"key": "operationType", "type": "str"}, } _subtype_map = { - 'container_type': {'SQLAGWorkLoadContainer': 'AzureSQLAGWorkloadContainerProtectionContainer', 'VMAppContainer': 'AzureVMAppContainerProtectionContainer'} + "container_type": { + "SQLAGWorkLoadContainer": "AzureSQLAGWorkloadContainerProtectionContainer", + "VMAppContainer": "AzureVMAppContainerProtectionContainer", + } } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, source_resource_id: Optional[str] = None, last_updated_time: Optional[datetime.datetime] = None, - extended_info: Optional["AzureWorkloadContainerExtendedInfo"] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, - operation_type: Optional[Union[str, "OperationType"]] = None, + extended_info: Optional["_models.AzureWorkloadContainerExtendedInfo"] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, + operation_type: Optional[Union[str, "_models.OperationType"]] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -4195,19 +4391,26 @@ def __init__( :keyword extended_info: Additional details of a workload container. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadContainerExtendedInfo - :keyword workload_type: Workload type for which registration was sent. Possible values include: + :keyword workload_type: Workload type for which registration was sent. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword operation_type: Re-Do Operation. Possible values include: "Invalid", "Register", + :keyword operation_type: Re-Do Operation. Known values are: "Invalid", "Register", and "Reregister". :paramtype operation_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationType """ - super(AzureWorkloadContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'AzureWorkloadContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "AzureWorkloadContainer" # type: str self.source_resource_id = source_resource_id self.last_updated_time = last_updated_time self.extended_info = extended_info @@ -4215,16 +4418,18 @@ def __init__( self.operation_type = operation_type -class AzureSQLAGWorkloadContainerProtectionContainer(AzureWorkloadContainer): +class AzureSQLAGWorkloadContainerProtectionContainer( + AzureWorkloadContainer +): # pylint: disable=too-many-instance-attributes """Container for SQL workloads under SQL Availability Group. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -4232,20 +4437,20 @@ class AzureSQLAGWorkloadContainerProtectionContainer(AzureWorkloadContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar source_resource_id: ARM ID of the virtual machine represented by this Azure Workload @@ -4256,57 +4461,57 @@ class AzureSQLAGWorkloadContainerProtectionContainer(AzureWorkloadContainer): :ivar extended_info: Additional details of a workload container. :vartype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadContainerExtendedInfo - :ivar workload_type: Workload type for which registration was sent. Possible values include: + :ivar workload_type: Workload type for which registration was sent. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar operation_type: Re-Do Operation. Possible values include: "Invalid", "Register", + :ivar operation_type: Re-Do Operation. Known values are: "Invalid", "Register", and "Reregister". :vartype operation_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationType """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadContainerExtendedInfo'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "last_updated_time": {"key": "lastUpdatedTime", "type": "iso-8601"}, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadContainerExtendedInfo"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "operation_type": {"key": "operationType", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, source_resource_id: Optional[str] = None, last_updated_time: Optional[datetime.datetime] = None, - extended_info: Optional["AzureWorkloadContainerExtendedInfo"] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, - operation_type: Optional[Union[str, "OperationType"]] = None, + extended_info: Optional["_models.AzureWorkloadContainerExtendedInfo"] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, + operation_type: Optional[Union[str, "_models.OperationType"]] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -4325,19 +4530,31 @@ def __init__( :keyword extended_info: Additional details of a workload container. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadContainerExtendedInfo - :keyword workload_type: Workload type for which registration was sent. Possible values include: + :keyword workload_type: Workload type for which registration was sent. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword operation_type: Re-Do Operation. Possible values include: "Invalid", "Register", + :keyword operation_type: Re-Do Operation. Known values are: "Invalid", "Register", and "Reregister". :paramtype operation_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationType """ - super(AzureSQLAGWorkloadContainerProtectionContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, source_resource_id=source_resource_id, last_updated_time=last_updated_time, extended_info=extended_info, workload_type=workload_type, operation_type=operation_type, **kwargs) - self.container_type = 'SQLAGWorkLoadContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + source_resource_id=source_resource_id, + last_updated_time=last_updated_time, + extended_info=extended_info, + workload_type=workload_type, + operation_type=operation_type, + **kwargs + ) + self.container_type = "SQLAGWorkLoadContainer" # type: str class AzureSqlContainer(ProtectionContainer): @@ -4347,9 +4564,9 @@ class AzureSqlContainer(ProtectionContainer): :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -4357,42 +4574,42 @@ class AzureSqlContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -4401,9 +4618,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -4415,26 +4632,35 @@ def __init__( container. :paramtype protectable_object_type: str """ - super(AzureSqlContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'AzureSqlContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "AzureSqlContainer" # type: str -class AzureSqlProtectedItem(ProtectedItem): +class AzureSqlProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Azure SQL workload-specific backup item. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -4449,7 +4675,7 @@ class AzureSqlProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -4474,8 +4700,8 @@ class AzureSqlProtectedItem(ProtectedItem): :ivar protected_item_data_id: Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services. :vartype protected_item_data_id: str - :ivar protection_state: Backup state of the backed up item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of the backed up item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemState :ivar extended_info: Additional information for this backup item. @@ -4484,43 +4710,43 @@ class AzureSqlProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureSqlProtectedItemExtendedInfo'}, + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureSqlProtectedItemExtendedInfo"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -4530,22 +4756,11 @@ def __init__( is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, protected_item_data_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectedItemState"]] = None, - extended_info: Optional["AzureSqlProtectedItemExtendedInfo"] = None, + protection_state: Optional[Union[str, "_models.ProtectedItemState"]] = None, + extended_info: Optional["_models.AzureSqlProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -4558,7 +4773,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -4584,23 +4799,38 @@ def __init__( :keyword protected_item_data_id: Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services. :paramtype protected_item_data_id: str - :keyword protection_state: Backup state of the backed up item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of the backed up item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemState :keyword extended_info: Additional information for this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureSqlProtectedItemExtendedInfo """ - super(AzureSqlProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'Microsoft.Sql/servers/databases' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "Microsoft.Sql/servers/databases" # type: str self.protected_item_data_id = protected_item_data_id self.protection_state = protection_state self.extended_info = extended_info -class AzureSqlProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureSqlProtectedItemExtendedInfo(_serialization.Model): """Additional information on Azure Sql specific protected item. :ivar oldest_recovery_point: The oldest backup copy available for this item in the service. @@ -4612,9 +4842,9 @@ class AzureSqlProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_state": {"key": "policyState", "type": "str"}, } def __init__( @@ -4634,7 +4864,7 @@ def __init__( :keyword policy_state: State of the backup policy associated with this backup item. :paramtype policy_state: str """ - super(AzureSqlProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count self.policy_state = policy_state @@ -4647,8 +4877,8 @@ class AzureSqlProtectionPolicy(ProtectionPolicy): :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] @@ -4658,14 +4888,14 @@ class AzureSqlProtectionPolicy(ProtectionPolicy): """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, } def __init__( @@ -4673,7 +4903,7 @@ def __init__( *, protected_items_count: Optional[int] = None, resource_guard_operation_requests: Optional[List[str]] = None, - retention_policy: Optional["RetentionPolicy"] = None, + retention_policy: Optional["_models.RetentionPolicy"] = None, **kwargs ): """ @@ -4685,21 +4915,25 @@ def __init__( :paramtype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy """ - super(AzureSqlProtectionPolicy, self).__init__(protected_items_count=protected_items_count, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.backup_management_type = 'AzureSql' # type: str + super().__init__( + protected_items_count=protected_items_count, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.backup_management_type = "AzureSql" # type: str self.retention_policy = retention_policy -class AzureStorageContainer(ProtectionContainer): +class AzureStorageContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes """Azure Storage Account workload-specific container. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -4707,20 +4941,20 @@ class AzureStorageContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar source_resource_id: Fully qualified ARM url. @@ -4730,36 +4964,36 @@ class AzureStorageContainer(ProtectionContainer): :ivar resource_group: Resource group name of Recovery Services Vault. :vartype resource_group: str :ivar protected_item_count: Number of items backed up in this container. - :vartype protected_item_count: long + :vartype protected_item_count: int :ivar acquire_storage_account_lock: Whether storage account lock is to be acquired for this - container or not. Possible values include: "Acquire", "NotAcquire". + container or not. Known values are: "Acquire" and "NotAcquire". :vartype acquire_storage_account_lock: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.AcquireStorageAccountLock """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'storage_account_version': {'key': 'storageAccountVersion', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'long'}, - 'acquire_storage_account_lock': {'key': 'acquireStorageAccountLock', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "storage_account_version": {"key": "storageAccountVersion", "type": "str"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "acquire_storage_account_lock": {"key": "acquireStorageAccountLock", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -4767,15 +5001,15 @@ def __init__( storage_account_version: Optional[str] = None, resource_group: Optional[str] = None, protected_item_count: Optional[int] = None, - acquire_storage_account_lock: Optional[Union[str, "AcquireStorageAccountLock"]] = None, + acquire_storage_account_lock: Optional[Union[str, "_models.AcquireStorageAccountLock"]] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -4793,14 +5027,21 @@ def __init__( :keyword resource_group: Resource group name of Recovery Services Vault. :paramtype resource_group: str :keyword protected_item_count: Number of items backed up in this container. - :paramtype protected_item_count: long + :paramtype protected_item_count: int :keyword acquire_storage_account_lock: Whether storage account lock is to be acquired for this - container or not. Possible values include: "Acquire", "NotAcquire". + container or not. Known values are: "Acquire" and "NotAcquire". :paramtype acquire_storage_account_lock: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.AcquireStorageAccountLock """ - super(AzureStorageContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'StorageContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "StorageContainer" # type: str self.source_resource_id = source_resource_id self.storage_account_version = storage_account_version self.resource_group = resource_group @@ -4808,7 +5049,7 @@ def __init__( self.acquire_storage_account_lock = acquire_storage_account_lock -class AzureStorageErrorInfo(msrest.serialization.Model): +class AzureStorageErrorInfo(_serialization.Model): """Azure storage specific error information. :ivar error_code: Error code. @@ -4820,9 +5061,9 @@ class AzureStorageErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } def __init__( @@ -4841,22 +5082,22 @@ def __init__( :keyword recommendations: List of localized recommendations for above error code. :paramtype recommendations: list[str] """ - super(AzureStorageErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_code = error_code self.error_string = error_string self.recommendations = recommendations -class AzureStorageJob(Job): +class AzureStorageJob(Job): # pylint: disable=too-many-instance-attributes """Azure storage specific job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -4869,8 +5110,8 @@ class AzureStorageJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed during the execution of this job. :vartype duration: ~datetime.timedelta @@ -4893,43 +5134,43 @@ class AzureStorageJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureStorageErrorInfo]'}, - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - 'storage_account_version': {'key': 'storageAccountVersion', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureStorageJobExtendedInfo'}, - 'is_user_triggered': {'key': 'isUserTriggered', 'type': 'bool'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[AzureStorageErrorInfo]"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "storage_account_version": {"key": "storageAccountVersion", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureStorageJobExtendedInfo"}, + "is_user_triggered": {"key": "isUserTriggered", "type": "bool"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["AzureStorageErrorInfo"]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.AzureStorageErrorInfo"]] = None, storage_account_name: Optional[str] = None, storage_account_version: Optional[str] = None, - extended_info: Optional["AzureStorageJobExtendedInfo"] = None, + extended_info: Optional["_models.AzureStorageJobExtendedInfo"] = None, is_user_triggered: Optional[bool] = None, **kwargs ): @@ -4937,9 +5178,9 @@ def __init__( :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -4971,8 +5212,17 @@ def __init__( :keyword is_user_triggered: Indicated that whether the job is adhoc(true) or scheduled(false). :paramtype is_user_triggered: bool """ - super(AzureStorageJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureStorageJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureStorageJob" # type: str self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -4982,7 +5232,7 @@ def __init__( self.is_user_triggered = is_user_triggered -class AzureStorageJobExtendedInfo(msrest.serialization.Model): +class AzureStorageJobExtendedInfo(_serialization.Model): """Azure Storage workload-specific additional information for job. :ivar tasks_list: List of tasks for this job. @@ -4995,15 +5245,15 @@ class AzureStorageJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[AzureStorageJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[AzureStorageJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["AzureStorageJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.AzureStorageJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -5017,13 +5267,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(AzureStorageJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class AzureStorageJobTaskDetails(msrest.serialization.Model): +class AzureStorageJobTaskDetails(_serialization.Model): """Azure storage workload specific job task details. :ivar task_id: The task display name. @@ -5033,57 +5283,49 @@ class AzureStorageJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "status": {"key": "status", "type": "str"}, } - def __init__( - self, - *, - task_id: Optional[str] = None, - status: Optional[str] = None, - **kwargs - ): + def __init__(self, *, task_id: Optional[str] = None, status: Optional[str] = None, **kwargs): """ :keyword task_id: The task display name. :paramtype task_id: str :keyword status: The status. :paramtype status: str """ - super(AzureStorageJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.status = status -class ProtectableContainer(msrest.serialization.Model): +class ProtectableContainer(_serialization.Model): """Protectable Container Class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureStorageProtectableContainer, AzureVMAppContainerProtectableContainer. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureStorageProtectableContainer, AzureVMAppContainerProtectableContainer All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar protectable_container_type: Required. Type of the container. The value of this property - for - - + :ivar protectable_container_type: Type of the container. The value of this property for + + #. Compute Azure VM is Microsoft.Compute/virtualMachines - #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines.Constant filled by - server. Possible values include: "Invalid", "Unknown", "IaasVMContainer", - "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", - "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", - "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines. Required. Known + values are: "Invalid", "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", + "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", + "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype protectable_container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar health_status: Status of health of the container. :vartype health_status: str :ivar container_id: Fabric Id of the container such as ARM Id. @@ -5091,26 +5333,29 @@ class ProtectableContainer(msrest.serialization.Model): """ _validation = { - 'protectable_container_type': {'required': True}, + "protectable_container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'protectable_container_type': {'key': 'protectableContainerType', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "protectable_container_type": {"key": "protectableContainerType", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, } _subtype_map = { - 'protectable_container_type': {'StorageContainer': 'AzureStorageProtectableContainer', 'VMAppContainer': 'AzureVMAppContainerProtectableContainer'} + "protectable_container_type": { + "StorageContainer": "AzureStorageProtectableContainer", + "VMAppContainer": "AzureVMAppContainerProtectableContainer", + } } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, health_status: Optional[str] = None, container_id: Optional[str] = None, **kwargs @@ -5118,9 +5363,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword health_status: Status of health of the container. @@ -5128,7 +5373,7 @@ def __init__( :keyword container_id: Fabric Id of the container such as ARM Id. :paramtype container_id: str """ - super(ProtectableContainer, self).__init__(**kwargs) + super().__init__(**kwargs) self.friendly_name = friendly_name self.backup_management_type = backup_management_type self.protectable_container_type = None # type: Optional[str] @@ -5143,25 +5388,23 @@ class AzureStorageProtectableContainer(ProtectableContainer): :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar protectable_container_type: Required. Type of the container. The value of this property - for - - + :ivar protectable_container_type: Type of the container. The value of this property for + + #. Compute Azure VM is Microsoft.Compute/virtualMachines - #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines.Constant filled by - server. Possible values include: "Invalid", "Unknown", "IaasVMContainer", - "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", - "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", - "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines. Required. Known + values are: "Invalid", "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", + "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", + "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype protectable_container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar health_status: Status of health of the container. :vartype health_status: str :ivar container_id: Fabric Id of the container such as ARM Id. @@ -5169,22 +5412,22 @@ class AzureStorageProtectableContainer(ProtectableContainer): """ _validation = { - 'protectable_container_type': {'required': True}, + "protectable_container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'protectable_container_type': {'key': 'protectableContainerType', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "protectable_container_type": {"key": "protectableContainerType", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, health_status: Optional[str] = None, container_id: Optional[str] = None, **kwargs @@ -5192,9 +5435,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword health_status: Status of health of the container. @@ -5202,8 +5445,14 @@ def __init__( :keyword container_id: Fabric Id of the container such as ARM Id. :paramtype container_id: str """ - super(AzureStorageProtectableContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, health_status=health_status, container_id=container_id, **kwargs) - self.protectable_container_type = 'StorageContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + health_status=health_status, + container_id=container_id, + **kwargs + ) + self.protectable_container_type = "StorageContainer" # type: str class AzureVMAppContainerProtectableContainer(ProtectableContainer): @@ -5213,25 +5462,23 @@ class AzureVMAppContainerProtectableContainer(ProtectableContainer): :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar protectable_container_type: Required. Type of the container. The value of this property - for - - + :ivar protectable_container_type: Type of the container. The value of this property for + + #. Compute Azure VM is Microsoft.Compute/virtualMachines - #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines.Constant filled by - server. Possible values include: "Invalid", "Unknown", "IaasVMContainer", - "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", - "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", - "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines. Required. Known + values are: "Invalid", "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", + "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", + "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype protectable_container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar health_status: Status of health of the container. :vartype health_status: str :ivar container_id: Fabric Id of the container such as ARM Id. @@ -5239,22 +5486,22 @@ class AzureVMAppContainerProtectableContainer(ProtectableContainer): """ _validation = { - 'protectable_container_type': {'required': True}, + "protectable_container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'protectable_container_type': {'key': 'protectableContainerType', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "protectable_container_type": {"key": "protectableContainerType", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, health_status: Optional[str] = None, container_id: Optional[str] = None, **kwargs @@ -5262,9 +5509,9 @@ def __init__( """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword health_status: Status of health of the container. @@ -5272,20 +5519,26 @@ def __init__( :keyword container_id: Fabric Id of the container such as ARM Id. :paramtype container_id: str """ - super(AzureVMAppContainerProtectableContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, health_status=health_status, container_id=container_id, **kwargs) - self.protectable_container_type = 'VMAppContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + health_status=health_status, + container_id=container_id, + **kwargs + ) + self.protectable_container_type = "VMAppContainer" # type: str -class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): +class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): # pylint: disable=too-many-instance-attributes """Container for SQL workloads under Azure Virtual Machines. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -5293,20 +5546,20 @@ class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar source_resource_id: ARM ID of the virtual machine represented by this Azure Workload @@ -5317,57 +5570,57 @@ class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): :ivar extended_info: Additional details of a workload container. :vartype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadContainerExtendedInfo - :ivar workload_type: Workload type for which registration was sent. Possible values include: + :ivar workload_type: Workload type for which registration was sent. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar operation_type: Re-Do Operation. Possible values include: "Invalid", "Register", + :ivar operation_type: Re-Do Operation. Known values are: "Invalid", "Register", and "Reregister". :vartype operation_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationType """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'iso-8601'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadContainerExtendedInfo'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'operation_type': {'key': 'operationType', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "last_updated_time": {"key": "lastUpdatedTime", "type": "iso-8601"}, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadContainerExtendedInfo"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "operation_type": {"key": "operationType", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, source_resource_id: Optional[str] = None, last_updated_time: Optional[datetime.datetime] = None, - extended_info: Optional["AzureWorkloadContainerExtendedInfo"] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, - operation_type: Optional[Union[str, "OperationType"]] = None, + extended_info: Optional["_models.AzureWorkloadContainerExtendedInfo"] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, + operation_type: Optional[Union[str, "_models.OperationType"]] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -5386,19 +5639,31 @@ def __init__( :keyword extended_info: Additional details of a workload container. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadContainerExtendedInfo - :keyword workload_type: Workload type for which registration was sent. Possible values include: + :keyword workload_type: Workload type for which registration was sent. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword operation_type: Re-Do Operation. Possible values include: "Invalid", "Register", + :keyword operation_type: Re-Do Operation. Known values are: "Invalid", "Register", and "Reregister". :paramtype operation_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationType """ - super(AzureVMAppContainerProtectionContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, source_resource_id=source_resource_id, last_updated_time=last_updated_time, extended_info=extended_info, workload_type=workload_type, operation_type=operation_type, **kwargs) - self.container_type = 'VMAppContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + source_resource_id=source_resource_id, + last_updated_time=last_updated_time, + extended_info=extended_info, + workload_type=workload_type, + operation_type=operation_type, + **kwargs + ) + self.container_type = "VMAppContainer" # type: str class AzureVMResourceFeatureSupportRequest(FeatureSupportRequest): @@ -5406,7 +5671,7 @@ class AzureVMResourceFeatureSupportRequest(FeatureSupportRequest): All required parameters must be populated in order to send to Azure. - :ivar feature_type: Required. backup support feature type.Constant filled by server. + :ivar feature_type: backup support feature type. Required. :vartype feature_type: str :ivar vm_size: Size of the resource: VM size(A/D series etc) in case of IaasVM. :vartype vm_size: str @@ -5415,68 +5680,57 @@ class AzureVMResourceFeatureSupportRequest(FeatureSupportRequest): """ _validation = { - 'feature_type': {'required': True}, + "feature_type": {"required": True}, } _attribute_map = { - 'feature_type': {'key': 'featureType', 'type': 'str'}, - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - 'vm_sku': {'key': 'vmSku', 'type': 'str'}, + "feature_type": {"key": "featureType", "type": "str"}, + "vm_size": {"key": "vmSize", "type": "str"}, + "vm_sku": {"key": "vmSku", "type": "str"}, } - def __init__( - self, - *, - vm_size: Optional[str] = None, - vm_sku: Optional[str] = None, - **kwargs - ): + def __init__(self, *, vm_size: Optional[str] = None, vm_sku: Optional[str] = None, **kwargs): """ :keyword vm_size: Size of the resource: VM size(A/D series etc) in case of IaasVM. :paramtype vm_size: str :keyword vm_sku: SKUs (Premium/Managed etc) in case of IaasVM. :paramtype vm_sku: str """ - super(AzureVMResourceFeatureSupportRequest, self).__init__(**kwargs) - self.feature_type = 'AzureVMResourceBackup' # type: str + super().__init__(**kwargs) + self.feature_type = "AzureVMResourceBackup" # type: str self.vm_size = vm_size self.vm_sku = vm_sku -class AzureVMResourceFeatureSupportResponse(msrest.serialization.Model): +class AzureVMResourceFeatureSupportResponse(_serialization.Model): """Response for feature support requests for Azure IaasVm. - :ivar support_status: Support status of feature. Possible values include: "Invalid", - "Supported", "DefaultOFF", "DefaultON", "NotSupported". + :ivar support_status: Support status of feature. Known values are: "Invalid", "Supported", + "DefaultOFF", "DefaultON", and "NotSupported". :vartype support_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SupportStatus """ _attribute_map = { - 'support_status': {'key': 'supportStatus', 'type': 'str'}, + "support_status": {"key": "supportStatus", "type": "str"}, } - def __init__( - self, - *, - support_status: Optional[Union[str, "SupportStatus"]] = None, - **kwargs - ): + def __init__(self, *, support_status: Optional[Union[str, "_models.SupportStatus"]] = None, **kwargs): """ - :keyword support_status: Support status of feature. Possible values include: "Invalid", - "Supported", "DefaultOFF", "DefaultON", "NotSupported". + :keyword support_status: Support status of feature. Known values are: "Invalid", "Supported", + "DefaultOFF", "DefaultON", and "NotSupported". :paramtype support_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SupportStatus """ - super(AzureVMResourceFeatureSupportResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.support_status = support_status -class WorkloadItem(msrest.serialization.Model): +class WorkloadItem(_serialization.Model): """Base class for backup item. Workload-specific backup items are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureVmWorkloadItem All required parameters must be populated in order to send to Azure. @@ -5484,31 +5738,29 @@ class WorkloadItem(msrest.serialization.Model): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, } - _subtype_map = { - 'workload_item_type': {'AzureVmWorkloadItem': 'AzureVmWorkloadItem'} - } + _subtype_map = {"workload_item_type": {"AzureVmWorkloadItem": "AzureVmWorkloadItem"}} def __init__( self, @@ -5516,7 +5768,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ @@ -5526,12 +5778,12 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(WorkloadItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_type = workload_type self.workload_item_type = None # type: Optional[str] @@ -5542,8 +5794,10 @@ def __init__( class AzureVmWorkloadItem(WorkloadItem): """Azure VM workload-specific workload item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadSAPAseDatabaseWorkloadItem, AzureVmWorkloadSAPAseSystemWorkloadItem, AzureVmWorkloadSAPHanaDatabaseWorkloadItem, AzureVmWorkloadSAPHanaSystemWorkloadItem, AzureVmWorkloadSQLDatabaseWorkloadItem, AzureVmWorkloadSQLInstanceWorkloadItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureVmWorkloadSAPAseDatabaseWorkloadItem, AzureVmWorkloadSAPAseSystemWorkloadItem, + AzureVmWorkloadSAPHanaDatabaseWorkloadItem, AzureVmWorkloadSAPHanaSystemWorkloadItem, + AzureVmWorkloadSQLDatabaseWorkloadItem, AzureVmWorkloadSQLInstanceWorkloadItem All required parameters must be populated in order to send to Azure. @@ -5551,12 +5805,12 @@ class AzureVmWorkloadItem(WorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -5572,24 +5826,31 @@ class AzureVmWorkloadItem(WorkloadItem): """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, } _subtype_map = { - 'workload_item_type': {'SAPAseDatabase': 'AzureVmWorkloadSAPAseDatabaseWorkloadItem', 'SAPAseSystem': 'AzureVmWorkloadSAPAseSystemWorkloadItem', 'SAPHanaDatabase': 'AzureVmWorkloadSAPHanaDatabaseWorkloadItem', 'SAPHanaSystem': 'AzureVmWorkloadSAPHanaSystemWorkloadItem', 'SQLDataBase': 'AzureVmWorkloadSQLDatabaseWorkloadItem', 'SQLInstance': 'AzureVmWorkloadSQLInstanceWorkloadItem'} + "workload_item_type": { + "SAPAseDatabase": "AzureVmWorkloadSAPAseDatabaseWorkloadItem", + "SAPAseSystem": "AzureVmWorkloadSAPAseSystemWorkloadItem", + "SAPHanaDatabase": "AzureVmWorkloadSAPHanaDatabaseWorkloadItem", + "SAPHanaSystem": "AzureVmWorkloadSAPHanaSystemWorkloadItem", + "SQLDataBase": "AzureVmWorkloadSQLDatabaseWorkloadItem", + "SQLInstance": "AzureVmWorkloadSQLInstanceWorkloadItem", + } } def __init__( @@ -5598,7 +5859,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, @@ -5613,8 +5874,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -5628,8 +5889,14 @@ def __init__( :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. :paramtype sub_workload_item_count: int """ - super(AzureVmWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, **kwargs) - self.workload_item_type = 'AzureVmWorkloadItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + **kwargs + ) + self.workload_item_type = "AzureVmWorkloadItem" # type: str self.parent_name = parent_name self.server_name = server_name self.is_auto_protectable = is_auto_protectable @@ -5637,11 +5904,15 @@ def __init__( self.sub_workload_item_count = sub_workload_item_count -class AzureVmWorkloadProtectableItem(WorkloadProtectableItem): +class AzureVmWorkloadProtectableItem(WorkloadProtectableItem): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadSAPAseSystemProtectableItem, AzureVmWorkloadSAPHanaDatabaseProtectableItem, AzureVmWorkloadSAPHanaSystemProtectableItem, AzureVmWorkloadSQLAvailabilityGroupProtectableItem, AzureVmWorkloadSQLDatabaseProtectableItem, AzureVmWorkloadSQLInstanceProtectableItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureVmWorkloadSAPAseSystemProtectableItem, AzureVmWorkloadSAPHanaDBInstance, + AzureVmWorkloadSAPHanaDatabaseProtectableItem, AzureVmWorkloadSAPHanaHSR, + AzureVmWorkloadSAPHanaSystemProtectableItem, + AzureVmWorkloadSQLAvailabilityGroupProtectableItem, AzureVmWorkloadSQLDatabaseProtectableItem, + AzureVmWorkloadSQLInstanceProtectableItem All required parameters must be populated in order to send to Azure. @@ -5649,12 +5920,12 @@ class AzureVmWorkloadProtectableItem(WorkloadProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -5679,27 +5950,36 @@ class AzureVmWorkloadProtectableItem(WorkloadProtectableItem): """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } _subtype_map = { - 'protectable_item_type': {'SAPAseSystem': 'AzureVmWorkloadSAPAseSystemProtectableItem', 'SAPHanaDatabase': 'AzureVmWorkloadSAPHanaDatabaseProtectableItem', 'SAPHanaSystem': 'AzureVmWorkloadSAPHanaSystemProtectableItem', 'SQLAvailabilityGroupContainer': 'AzureVmWorkloadSQLAvailabilityGroupProtectableItem', 'SQLDataBase': 'AzureVmWorkloadSQLDatabaseProtectableItem', 'SQLInstance': 'AzureVmWorkloadSQLInstanceProtectableItem'} + "protectable_item_type": { + "SAPAseSystem": "AzureVmWorkloadSAPAseSystemProtectableItem", + "SAPHanaDBInstance": "AzureVmWorkloadSAPHanaDBInstance", + "SAPHanaDatabase": "AzureVmWorkloadSAPHanaDatabaseProtectableItem", + "SAPHanaHSR": "AzureVmWorkloadSAPHanaHSR", + "SAPHanaSystem": "AzureVmWorkloadSAPHanaSystemProtectableItem", + "SQLAvailabilityGroupContainer": "AzureVmWorkloadSQLAvailabilityGroupProtectableItem", + "SQLDataBase": "AzureVmWorkloadSQLDatabaseProtectableItem", + "SQLInstance": "AzureVmWorkloadSQLInstanceProtectableItem", + } } def __init__( @@ -5708,7 +5988,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -5716,7 +5996,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -5726,8 +6006,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -5750,8 +6030,14 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, **kwargs) - self.protectable_item_type = 'AzureVmWorkloadProtectableItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + **kwargs + ) + self.protectable_item_type = "AzureVmWorkloadProtectableItem" # type: str self.parent_name = parent_name self.parent_unique_name = parent_unique_name self.server_name = server_name @@ -5762,25 +6048,28 @@ def __init__( self.prebackupvalidation = prebackupvalidation -class AzureVmWorkloadProtectedItem(ProtectedItem): +class AzureVmWorkloadProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadSAPAseDatabaseProtectedItem, AzureVmWorkloadSAPHanaDatabaseProtectedItem, AzureVmWorkloadSQLDatabaseProtectedItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureVmWorkloadSAPAseDatabaseProtectedItem, AzureVmWorkloadSAPHanaDBInstanceProtectedItem, + AzureVmWorkloadSAPHanaDatabaseProtectedItem, AzureVmWorkloadSQLDatabaseProtectedItem + + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -5795,7 +6084,7 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -5828,12 +6117,12 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -5844,7 +6133,7 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus @@ -5857,57 +6146,64 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "protection_status": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, } _subtype_map = { - 'protected_item_type': {'AzureVmWorkloadSAPAseDatabase': 'AzureVmWorkloadSAPAseDatabaseProtectedItem', 'AzureVmWorkloadSAPHanaDatabase': 'AzureVmWorkloadSAPHanaDatabaseProtectedItem', 'AzureVmWorkloadSQLDatabase': 'AzureVmWorkloadSQLDatabaseProtectedItem'} + "protected_item_type": { + "AzureVmWorkloadSAPAseDatabase": "AzureVmWorkloadSAPAseDatabaseProtectedItem", + "AzureVmWorkloadSAPHanaDBInstance": "AzureVmWorkloadSAPHanaDBInstanceProtectedItem", + "AzureVmWorkloadSAPHanaDatabase": "AzureVmWorkloadSAPHanaDatabaseProtectedItem", + "AzureVmWorkloadSQLDatabase": "AzureVmWorkloadSQLDatabaseProtectedItem", + } } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -5916,33 +6212,20 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, - protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -5955,7 +6238,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -5978,8 +6261,6 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the DB represented by this backup item. - :paramtype friendly_name: str :keyword server_name: Host/Cluster Name for instance or AG. :paramtype server_name: str :keyword parent_name: Parent name of the DB such as Instance or Availability Group. @@ -5987,15 +6268,12 @@ def __init__( :keyword parent_type: Parent type of protected item, example: for a DB, standalone server or distributed. :paramtype parent_type: str - :keyword protection_status: Backup status of this backup item. - :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -6006,8 +6284,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -6017,13 +6295,29 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'AzureVmWorkloadProtectedItem' # type: str - self.friendly_name = friendly_name + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadProtectedItem" # type: str + self.friendly_name = None self.server_name = server_name self.parent_name = parent_name self.parent_type = parent_type - self.protection_status = protection_status + self.protection_status = None self.protection_state = protection_state self.last_backup_status = last_backup_status self.last_backup_time = last_backup_time @@ -6034,11 +6328,21 @@ def __init__( self.kpis_healths = kpis_healths -class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureVmWorkloadProtectedItemExtendedInfo(_serialization.Model): """Additional information on Azure Workload for SQL specific backup item. - :ivar oldest_recovery_point: The oldest backup copy available for this backup item. + :ivar oldest_recovery_point: The oldest backup copy available for this backup item across all + tiers. :vartype oldest_recovery_point: ~datetime.datetime + :ivar oldest_recovery_point_in_vault: The oldest backup copy available for this backup item in + vault tier. + :vartype oldest_recovery_point_in_vault: ~datetime.datetime + :ivar oldest_recovery_point_in_archive: The oldest backup copy available for this backup item + in archive tier. + :vartype oldest_recovery_point_in_archive: ~datetime.datetime + :ivar newest_recovery_point_in_archive: The latest backup copy available for this backup item + in archive tier. + :vartype newest_recovery_point_in_archive: ~datetime.datetime :ivar recovery_point_count: Number of backup copies available for this backup item. :vartype recovery_point_count: int :ivar policy_state: Indicates consistency of policy object and policy applied to this backup @@ -6050,24 +6354,40 @@ class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, - 'recovery_model': {'key': 'recoveryModel', 'type': 'str'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "oldest_recovery_point_in_vault": {"key": "oldestRecoveryPointInVault", "type": "iso-8601"}, + "oldest_recovery_point_in_archive": {"key": "oldestRecoveryPointInArchive", "type": "iso-8601"}, + "newest_recovery_point_in_archive": {"key": "newestRecoveryPointInArchive", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_state": {"key": "policyState", "type": "str"}, + "recovery_model": {"key": "recoveryModel", "type": "str"}, } def __init__( self, *, oldest_recovery_point: Optional[datetime.datetime] = None, + oldest_recovery_point_in_vault: Optional[datetime.datetime] = None, + oldest_recovery_point_in_archive: Optional[datetime.datetime] = None, + newest_recovery_point_in_archive: Optional[datetime.datetime] = None, recovery_point_count: Optional[int] = None, policy_state: Optional[str] = None, recovery_model: Optional[str] = None, **kwargs ): """ - :keyword oldest_recovery_point: The oldest backup copy available for this backup item. + :keyword oldest_recovery_point: The oldest backup copy available for this backup item across + all tiers. :paramtype oldest_recovery_point: ~datetime.datetime + :keyword oldest_recovery_point_in_vault: The oldest backup copy available for this backup item + in vault tier. + :paramtype oldest_recovery_point_in_vault: ~datetime.datetime + :keyword oldest_recovery_point_in_archive: The oldest backup copy available for this backup + item in archive tier. + :paramtype oldest_recovery_point_in_archive: ~datetime.datetime + :keyword newest_recovery_point_in_archive: The latest backup copy available for this backup + item in archive tier. + :paramtype newest_recovery_point_in_archive: ~datetime.datetime :keyword recovery_point_count: Number of backup copies available for this backup item. :paramtype recovery_point_count: int :keyword policy_state: Indicates consistency of policy object and policy applied to this backup @@ -6077,8 +6397,11 @@ def __init__( backup item. :paramtype recovery_model: str """ - super(AzureVmWorkloadProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point + self.oldest_recovery_point_in_vault = oldest_recovery_point_in_vault + self.oldest_recovery_point_in_archive = oldest_recovery_point_in_archive + self.newest_recovery_point_in_archive = newest_recovery_point_in_archive self.recovery_point_count = recovery_point_count self.policy_state = policy_state self.recovery_model = recovery_model @@ -6091,15 +6414,15 @@ class AzureVmWorkloadProtectionPolicy(ProtectionPolicy): :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] - :ivar work_load_type: Type of workload for the backup management. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :ivar work_load_type: Type of workload for the backup management. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype work_load_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :ivar settings: Common settings for the backup management. @@ -6113,17 +6436,17 @@ class AzureVmWorkloadProtectionPolicy(ProtectionPolicy): """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'work_load_type': {'key': 'workLoadType', 'type': 'str'}, - 'settings': {'key': 'settings', 'type': 'Settings'}, - 'sub_protection_policy': {'key': 'subProtectionPolicy', 'type': '[SubProtectionPolicy]'}, - 'make_policy_consistent': {'key': 'makePolicyConsistent', 'type': 'bool'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "work_load_type": {"key": "workLoadType", "type": "str"}, + "settings": {"key": "settings", "type": "Settings"}, + "sub_protection_policy": {"key": "subProtectionPolicy", "type": "[SubProtectionPolicy]"}, + "make_policy_consistent": {"key": "makePolicyConsistent", "type": "bool"}, } def __init__( @@ -6131,9 +6454,9 @@ def __init__( *, protected_items_count: Optional[int] = None, resource_guard_operation_requests: Optional[List[str]] = None, - work_load_type: Optional[Union[str, "WorkloadType"]] = None, - settings: Optional["Settings"] = None, - sub_protection_policy: Optional[List["SubProtectionPolicy"]] = None, + work_load_type: Optional[Union[str, "_models.WorkloadType"]] = None, + settings: Optional["_models.Settings"] = None, + sub_protection_policy: Optional[List["_models.SubProtectionPolicy"]] = None, make_policy_consistent: Optional[bool] = None, **kwargs ): @@ -6142,10 +6465,10 @@ def __init__( :paramtype protected_items_count: int :keyword resource_guard_operation_requests: ResourceGuard Operation Requests. :paramtype resource_guard_operation_requests: list[str] - :keyword work_load_type: Type of workload for the backup management. Possible values include: + :keyword work_load_type: Type of workload for the backup management. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype work_load_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :keyword settings: Common settings for the backup management. @@ -6157,30 +6480,38 @@ def __init__( :keyword make_policy_consistent: Fix the policy inconsistency. :paramtype make_policy_consistent: bool """ - super(AzureVmWorkloadProtectionPolicy, self).__init__(protected_items_count=protected_items_count, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.backup_management_type = 'AzureWorkload' # type: str + super().__init__( + protected_items_count=protected_items_count, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.backup_management_type = "AzureWorkload" # type: str self.work_load_type = work_load_type self.settings = settings self.sub_protection_policy = sub_protection_policy self.make_policy_consistent = make_policy_consistent -class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): +class AzureVmWorkloadSAPAseDatabaseProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item representing SAP ASE Database. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -6195,7 +6526,7 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -6228,12 +6559,12 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -6244,7 +6575,7 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus @@ -6257,53 +6588,55 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "protection_status": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -6312,33 +6645,20 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, - protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -6351,7 +6671,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -6374,8 +6694,6 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the DB represented by this backup item. - :paramtype friendly_name: str :keyword server_name: Host/Cluster Name for instance or AG. :paramtype server_name: str :keyword parent_name: Parent name of the DB such as Instance or Availability Group. @@ -6383,15 +6701,12 @@ def __init__( :keyword parent_type: Parent type of protected item, example: for a DB, standalone server or distributed. :paramtype parent_type: str - :keyword protection_status: Backup status of this backup item. - :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -6402,8 +6717,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -6413,8 +6728,35 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPAseDatabaseProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, friendly_name=friendly_name, server_name=server_name, parent_name=parent_name, parent_type=parent_type, protection_status=protection_status, protection_state=protection_state, last_backup_status=last_backup_status, last_backup_time=last_backup_time, last_backup_error_detail=last_backup_error_detail, protected_item_data_source_id=protected_item_data_source_id, protected_item_health_status=protected_item_health_status, extended_info=extended_info, kpis_healths=kpis_healths, **kwargs) - self.protected_item_type = 'AzureVmWorkloadSAPAseDatabase' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSAPAseDatabase" # type: str class AzureVmWorkloadSAPAseDatabaseWorkloadItem(AzureVmWorkloadItem): @@ -6426,12 +6768,12 @@ class AzureVmWorkloadSAPAseDatabaseWorkloadItem(AzureVmWorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6447,20 +6789,20 @@ class AzureVmWorkloadSAPAseDatabaseWorkloadItem(AzureVmWorkloadItem): """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, } def __init__( @@ -6469,7 +6811,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, @@ -6484,8 +6826,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6499,11 +6841,24 @@ def __init__( :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. :paramtype sub_workload_item_count: int """ - super(AzureVmWorkloadSAPAseDatabaseWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, server_name=server_name, is_auto_protectable=is_auto_protectable, subinquireditemcount=subinquireditemcount, sub_workload_item_count=sub_workload_item_count, **kwargs) - self.workload_item_type = 'SAPAseDatabase' # type: str - - -class AzureVmWorkloadSAPAseSystemProtectableItem(AzureVmWorkloadProtectableItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + subinquireditemcount=subinquireditemcount, + sub_workload_item_count=sub_workload_item_count, + **kwargs + ) + self.workload_item_type = "SAPAseDatabase" # type: str + + +class AzureVmWorkloadSAPAseSystemProtectableItem( + AzureVmWorkloadProtectableItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item representing SAP ASE System. All required parameters must be populated in order to send to Azure. @@ -6512,12 +6867,12 @@ class AzureVmWorkloadSAPAseSystemProtectableItem(AzureVmWorkloadProtectableItem) :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6542,23 +6897,23 @@ class AzureVmWorkloadSAPAseSystemProtectableItem(AzureVmWorkloadProtectableItem) """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -6567,7 +6922,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -6575,7 +6930,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -6585,8 +6940,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6609,8 +6964,22 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSAPAseSystemProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, parent_unique_name=parent_unique_name, server_name=server_name, is_auto_protectable=is_auto_protectable, is_auto_protected=is_auto_protected, subinquireditemcount=subinquireditemcount, subprotectableitemcount=subprotectableitemcount, prebackupvalidation=prebackupvalidation, **kwargs) - self.protectable_item_type = 'SAPAseSystem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SAPAseSystem" # type: str class AzureVmWorkloadSAPAseSystemWorkloadItem(AzureVmWorkloadItem): @@ -6622,12 +6991,12 @@ class AzureVmWorkloadSAPAseSystemWorkloadItem(AzureVmWorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6643,20 +7012,20 @@ class AzureVmWorkloadSAPAseSystemWorkloadItem(AzureVmWorkloadItem): """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, } def __init__( @@ -6665,7 +7034,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, @@ -6680,8 +7049,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6695,11 +7064,24 @@ def __init__( :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. :paramtype sub_workload_item_count: int """ - super(AzureVmWorkloadSAPAseSystemWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, server_name=server_name, is_auto_protectable=is_auto_protectable, subinquireditemcount=subinquireditemcount, sub_workload_item_count=sub_workload_item_count, **kwargs) - self.workload_item_type = 'SAPAseSystem' # type: str - - -class AzureVmWorkloadSAPHanaDatabaseProtectableItem(AzureVmWorkloadProtectableItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + subinquireditemcount=subinquireditemcount, + sub_workload_item_count=sub_workload_item_count, + **kwargs + ) + self.workload_item_type = "SAPAseSystem" # type: str + + +class AzureVmWorkloadSAPHanaDatabaseProtectableItem( + AzureVmWorkloadProtectableItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item representing SAP HANA Database. All required parameters must be populated in order to send to Azure. @@ -6708,12 +7090,12 @@ class AzureVmWorkloadSAPHanaDatabaseProtectableItem(AzureVmWorkloadProtectableIt :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6738,23 +7120,23 @@ class AzureVmWorkloadSAPHanaDatabaseProtectableItem(AzureVmWorkloadProtectableIt """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -6763,7 +7145,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -6771,7 +7153,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -6781,8 +7163,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6805,26 +7187,44 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSAPHanaDatabaseProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, parent_unique_name=parent_unique_name, server_name=server_name, is_auto_protectable=is_auto_protectable, is_auto_protected=is_auto_protected, subinquireditemcount=subinquireditemcount, subprotectableitemcount=subprotectableitemcount, prebackupvalidation=prebackupvalidation, **kwargs) - self.protectable_item_type = 'SAPHanaDatabase' # type: str - - -class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SAPHanaDatabase" # type: str + + +class AzureVmWorkloadSAPHanaDatabaseProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item representing SAP HANA Database. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -6839,7 +7239,7 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -6872,12 +7272,12 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -6888,7 +7288,7 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus @@ -6901,53 +7301,55 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "protection_status": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -6956,33 +7358,508 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, - protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, + **kwargs + ): + """ + :keyword container_name: Unique name of container. + :paramtype container_name: str + :keyword source_resource_id: ARM ID of the resource to be backed up. + :paramtype source_resource_id: str + :keyword policy_id: ID of the backup policy with which this item is backed up. + :paramtype policy_id: str + :keyword last_recovery_point: Timestamp when the last (latest) backup copy was created for this + backup item. + :paramtype last_recovery_point: ~datetime.datetime + :keyword backup_set_name: Name of the backup set the backup item belongs to. + :paramtype backup_set_name: str + :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or + creation of new data source. Known values are: "Invalid", "Default", and "Recover". + :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode + :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. + :paramtype deferred_delete_time_in_utc: ~datetime.datetime + :keyword is_scheduled_for_deferred_delete: Flag to identify whether the DS is scheduled for + deferred delete. + :paramtype is_scheduled_for_deferred_delete: bool + :keyword deferred_delete_time_remaining: Time remaining before the DS marked for deferred + delete is permanently deleted. + :paramtype deferred_delete_time_remaining: str + :keyword is_deferred_delete_schedule_upcoming: Flag to identify whether the deferred deleted DS + is to be purged soon. + :paramtype is_deferred_delete_schedule_upcoming: bool + :keyword is_rehydrate: Flag to identify that deferred deleted DS is to be moved into Pause + state. + :paramtype is_rehydrate: bool + :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check + will be performed. + :paramtype resource_guard_operation_requests: list[str] + :keyword is_archive_enabled: Flag to identify whether datasource is protected in archive. + :paramtype is_archive_enabled: bool + :keyword policy_name: Name of the policy used for protection. + :paramtype policy_name: str + :keyword server_name: Host/Cluster Name for instance or AG. + :paramtype server_name: str + :keyword parent_name: Parent name of the DB such as Instance or Availability Group. + :paramtype parent_name: str + :keyword parent_type: Parent type of protected item, example: for a DB, standalone server or + distributed. + :paramtype parent_type: str + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". + :paramtype protection_state: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState + :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". + :paramtype last_backup_status: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus + :keyword last_backup_time: Timestamp of the last backup operation on this backup item. + :paramtype last_backup_time: ~datetime.datetime + :keyword last_backup_error_detail: Error details in last backup. + :paramtype last_backup_error_detail: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ErrorDetail + :keyword protected_item_data_source_id: Data ID of the protected item. + :paramtype protected_item_data_source_id: str + :keyword protected_item_health_status: Health status of the backup item, evaluated based on + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". + :paramtype protected_item_health_status: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus + :keyword extended_info: Additional information for this backup item. + :paramtype extended_info: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVmWorkloadProtectedItemExtendedInfo + :keyword kpis_healths: Health details of different KPIs. + :paramtype kpis_healths: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] + """ + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSAPHanaDatabase" # type: str + + +class AzureVmWorkloadSAPHanaDatabaseWorkloadItem(AzureVmWorkloadItem): + """Azure VM workload-specific workload item representing SAP HANA Database. + + All required parameters must be populated in order to send to Azure. + + :ivar backup_management_type: Type of backup management to backup an item. + :vartype backup_management_type: str + :ivar workload_type: Type of workload for the backup management. + :vartype workload_type: str + :ivar workload_item_type: Type of the backup item. Required. + :vartype workload_item_type: str + :ivar friendly_name: Friendly name of the backup item. + :vartype friendly_name: str + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". + :vartype protection_state: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus + :ivar parent_name: Name for instance or AG. + :vartype parent_name: str + :ivar server_name: Host/Cluster Name for instance or AG. + :vartype server_name: str + :ivar is_auto_protectable: Indicates if workload item is auto-protectable. + :vartype is_auto_protectable: bool + :ivar subinquireditemcount: For instance or AG, indicates number of DB's present. + :vartype subinquireditemcount: int + :ivar sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. + :vartype sub_workload_item_count: int + """ + + _validation = { + "workload_item_type": {"required": True}, + } + + _attribute_map = { + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, + } + + def __init__( + self, + *, + backup_management_type: Optional[str] = None, + workload_type: Optional[str] = None, + friendly_name: Optional[str] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, + parent_name: Optional[str] = None, + server_name: Optional[str] = None, + is_auto_protectable: Optional[bool] = None, + subinquireditemcount: Optional[int] = None, + sub_workload_item_count: Optional[int] = None, + **kwargs + ): + """ + :keyword backup_management_type: Type of backup management to backup an item. + :paramtype backup_management_type: str + :keyword workload_type: Type of workload for the backup management. + :paramtype workload_type: str + :keyword friendly_name: Friendly name of the backup item. + :paramtype friendly_name: str + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". + :paramtype protection_state: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus + :keyword parent_name: Name for instance or AG. + :paramtype parent_name: str + :keyword server_name: Host/Cluster Name for instance or AG. + :paramtype server_name: str + :keyword is_auto_protectable: Indicates if workload item is auto-protectable. + :paramtype is_auto_protectable: bool + :keyword subinquireditemcount: For instance or AG, indicates number of DB's present. + :paramtype subinquireditemcount: int + :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. + :paramtype sub_workload_item_count: int + """ + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + subinquireditemcount=subinquireditemcount, + sub_workload_item_count=sub_workload_item_count, + **kwargs + ) + self.workload_item_type = "SAPHanaDatabase" # type: str + + +class AzureVmWorkloadSAPHanaDBInstance(AzureVmWorkloadProtectableItem): # pylint: disable=too-many-instance-attributes + """Azure VM workload-specific protectable item representing SAP HANA Dbinstance. + + All required parameters must be populated in order to send to Azure. + + :ivar backup_management_type: Type of backup management to backup an item. + :vartype backup_management_type: str + :ivar workload_type: Type of workload for the backup management. + :vartype workload_type: str + :ivar protectable_item_type: Type of the backup item. Required. + :vartype protectable_item_type: str + :ivar friendly_name: Friendly name of the backup item. + :vartype friendly_name: str + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". + :vartype protection_state: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus + :ivar parent_name: Name for instance or AG. + :vartype parent_name: str + :ivar parent_unique_name: Parent Unique Name is added to provide the service formatted URI Name + of the Parent + Only Applicable for data bases where the parent would be either Instance or a SQL AG. + :vartype parent_unique_name: str + :ivar server_name: Host/Cluster Name for instance or AG. + :vartype server_name: str + :ivar is_auto_protectable: Indicates if protectable item is auto-protectable. + :vartype is_auto_protectable: bool + :ivar is_auto_protected: Indicates if protectable item is auto-protected. + :vartype is_auto_protected: bool + :ivar subinquireditemcount: For instance or AG, indicates number of DB's present. + :vartype subinquireditemcount: int + :ivar subprotectableitemcount: For instance or AG, indicates number of DB's to be protected. + :vartype subprotectableitemcount: int + :ivar prebackupvalidation: Pre-backup validation for protectable objects. + :vartype prebackupvalidation: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation + """ + + _validation = { + "protectable_item_type": {"required": True}, + } + + _attribute_map = { + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, + } + + def __init__( + self, + *, + backup_management_type: Optional[str] = None, + workload_type: Optional[str] = None, + friendly_name: Optional[str] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, + parent_name: Optional[str] = None, + parent_unique_name: Optional[str] = None, + server_name: Optional[str] = None, + is_auto_protectable: Optional[bool] = None, + is_auto_protected: Optional[bool] = None, + subinquireditemcount: Optional[int] = None, + subprotectableitemcount: Optional[int] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, + **kwargs + ): + """ + :keyword backup_management_type: Type of backup management to backup an item. + :paramtype backup_management_type: str + :keyword workload_type: Type of workload for the backup management. + :paramtype workload_type: str + :keyword friendly_name: Friendly name of the backup item. + :paramtype friendly_name: str + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". + :paramtype protection_state: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus + :keyword parent_name: Name for instance or AG. + :paramtype parent_name: str + :keyword parent_unique_name: Parent Unique Name is added to provide the service formatted URI + Name of the Parent + Only Applicable for data bases where the parent would be either Instance or a SQL AG. + :paramtype parent_unique_name: str + :keyword server_name: Host/Cluster Name for instance or AG. + :paramtype server_name: str + :keyword is_auto_protectable: Indicates if protectable item is auto-protectable. + :paramtype is_auto_protectable: bool + :keyword is_auto_protected: Indicates if protectable item is auto-protected. + :paramtype is_auto_protected: bool + :keyword subinquireditemcount: For instance or AG, indicates number of DB's present. + :paramtype subinquireditemcount: int + :keyword subprotectableitemcount: For instance or AG, indicates number of DB's to be protected. + :paramtype subprotectableitemcount: int + :keyword prebackupvalidation: Pre-backup validation for protectable objects. + :paramtype prebackupvalidation: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation + """ + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SAPHanaDBInstance" # type: str + + +class AzureVmWorkloadSAPHanaDBInstanceProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes + """Azure VM workload-specific protected item representing SAP HANA DBInstance. + + 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 protected_item_type: backup item type. Required. + :vartype protected_item_type: str + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". + :vartype backup_management_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + "SAPAseDatabase", and "SAPHanaDBInstance". + :vartype workload_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType + :ivar container_name: Unique name of container. + :vartype container_name: str + :ivar source_resource_id: ARM ID of the resource to be backed up. + :vartype source_resource_id: str + :ivar policy_id: ID of the backup policy with which this item is backed up. + :vartype policy_id: str + :ivar last_recovery_point: Timestamp when the last (latest) backup copy was created for this + backup item. + :vartype last_recovery_point: ~datetime.datetime + :ivar backup_set_name: Name of the backup set the backup item belongs to. + :vartype backup_set_name: str + :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or + creation of new data source. Known values are: "Invalid", "Default", and "Recover". + :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode + :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. + :vartype deferred_delete_time_in_utc: ~datetime.datetime + :ivar is_scheduled_for_deferred_delete: Flag to identify whether the DS is scheduled for + deferred delete. + :vartype is_scheduled_for_deferred_delete: bool + :ivar deferred_delete_time_remaining: Time remaining before the DS marked for deferred delete + is permanently deleted. + :vartype deferred_delete_time_remaining: str + :ivar is_deferred_delete_schedule_upcoming: Flag to identify whether the deferred deleted DS is + to be purged soon. + :vartype is_deferred_delete_schedule_upcoming: bool + :ivar is_rehydrate: Flag to identify that deferred deleted DS is to be moved into Pause state. + :vartype is_rehydrate: bool + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar is_archive_enabled: Flag to identify whether datasource is protected in archive. + :vartype is_archive_enabled: bool + :ivar policy_name: Name of the policy used for protection. + :vartype policy_name: str + :ivar friendly_name: Friendly name of the DB represented by this backup item. + :vartype friendly_name: str + :ivar server_name: Host/Cluster Name for instance or AG. + :vartype server_name: str + :ivar parent_name: Parent name of the DB such as Instance or Availability Group. + :vartype parent_name: str + :ivar parent_type: Parent type of protected item, example: for a DB, standalone server or + distributed. + :vartype parent_type: str + :ivar protection_status: Backup status of this backup item. + :vartype protection_status: str + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". + :vartype protection_state: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState + :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". + :vartype last_backup_status: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus + :ivar last_backup_time: Timestamp of the last backup operation on this backup item. + :vartype last_backup_time: ~datetime.datetime + :ivar last_backup_error_detail: Error details in last backup. + :vartype last_backup_error_detail: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ErrorDetail + :ivar protected_item_data_source_id: Data ID of the protected item. + :vartype protected_item_data_source_id: str + :ivar protected_item_health_status: Health status of the backup item, evaluated based on last + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and + "IRPending". + :vartype protected_item_health_status: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus + :ivar extended_info: Additional information for this backup item. + :vartype extended_info: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVmWorkloadProtectedItemExtendedInfo + :ivar kpis_healths: Health details of different KPIs. + :vartype kpis_healths: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] + """ + + _validation = { + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "protection_status": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + container_name: Optional[str] = None, + source_resource_id: Optional[str] = None, + policy_id: Optional[str] = None, + last_recovery_point: Optional[datetime.datetime] = None, + backup_set_name: Optional[str] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + deferred_delete_time_in_utc: Optional[datetime.datetime] = None, + is_scheduled_for_deferred_delete: Optional[bool] = None, + deferred_delete_time_remaining: Optional[str] = None, + is_deferred_delete_schedule_upcoming: Optional[bool] = None, + is_rehydrate: Optional[bool] = None, + resource_guard_operation_requests: Optional[List[str]] = None, + is_archive_enabled: Optional[bool] = None, + policy_name: Optional[str] = None, + server_name: Optional[str] = None, + parent_name: Optional[str] = None, + parent_type: Optional[str] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, + last_backup_time: Optional[datetime.datetime] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, + protected_item_data_source_id: Optional[str] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -6995,7 +7872,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -7018,8 +7895,6 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the DB represented by this backup item. - :paramtype friendly_name: str :keyword server_name: Host/Cluster Name for instance or AG. :paramtype server_name: str :keyword parent_name: Parent name of the DB such as Instance or Availability Group. @@ -7027,15 +7902,12 @@ def __init__( :keyword parent_type: Parent type of protected item, example: for a DB, standalone server or distributed. :paramtype parent_type: str - :keyword protection_status: Backup status of this backup item. - :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -7046,8 +7918,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -7057,12 +7929,39 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPHanaDatabaseProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, friendly_name=friendly_name, server_name=server_name, parent_name=parent_name, parent_type=parent_type, protection_status=protection_status, protection_state=protection_state, last_backup_status=last_backup_status, last_backup_time=last_backup_time, last_backup_error_detail=last_backup_error_detail, protected_item_data_source_id=protected_item_data_source_id, protected_item_health_status=protected_item_health_status, extended_info=extended_info, kpis_healths=kpis_healths, **kwargs) - self.protected_item_type = 'AzureVmWorkloadSAPHanaDatabase' # type: str - - -class AzureVmWorkloadSAPHanaDatabaseWorkloadItem(AzureVmWorkloadItem): - """Azure VM workload-specific workload item representing SAP HANA Database. + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSAPHanaDBInstance" # type: str + + +class AzureVmWorkloadSAPHanaHSR(AzureVmWorkloadProtectableItem): # pylint: disable=too-many-instance-attributes + """Azure VM workload-specific protectable item representing SAP HANA Dbinstance. All required parameters must be populated in order to send to Azure. @@ -7070,41 +7969,53 @@ class AzureVmWorkloadSAPHanaDatabaseWorkloadItem(AzureVmWorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. - :vartype workload_item_type: str + :ivar protectable_item_type: Type of the backup item. Required. + :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. :vartype parent_name: str + :ivar parent_unique_name: Parent Unique Name is added to provide the service formatted URI Name + of the Parent + Only Applicable for data bases where the parent would be either Instance or a SQL AG. + :vartype parent_unique_name: str :ivar server_name: Host/Cluster Name for instance or AG. :vartype server_name: str - :ivar is_auto_protectable: Indicates if workload item is auto-protectable. + :ivar is_auto_protectable: Indicates if protectable item is auto-protectable. :vartype is_auto_protectable: bool + :ivar is_auto_protected: Indicates if protectable item is auto-protected. + :vartype is_auto_protected: bool :ivar subinquireditemcount: For instance or AG, indicates number of DB's present. :vartype subinquireditemcount: int - :ivar sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. - :vartype sub_workload_item_count: int + :ivar subprotectableitemcount: For instance or AG, indicates number of DB's to be protected. + :vartype subprotectableitemcount: int + :ivar prebackupvalidation: Pre-backup validation for protectable objects. + :vartype prebackupvalidation: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ _validation = { - 'workload_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -7113,12 +8024,15 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, + parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, + is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, - sub_workload_item_count: Optional[int] = None, + subprotectableitemcount: Optional[int] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -7128,26 +8042,51 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. :paramtype parent_name: str + :keyword parent_unique_name: Parent Unique Name is added to provide the service formatted URI + Name of the Parent + Only Applicable for data bases where the parent would be either Instance or a SQL AG. + :paramtype parent_unique_name: str :keyword server_name: Host/Cluster Name for instance or AG. :paramtype server_name: str - :keyword is_auto_protectable: Indicates if workload item is auto-protectable. + :keyword is_auto_protectable: Indicates if protectable item is auto-protectable. :paramtype is_auto_protectable: bool + :keyword is_auto_protected: Indicates if protectable item is auto-protected. + :paramtype is_auto_protected: bool :keyword subinquireditemcount: For instance or AG, indicates number of DB's present. :paramtype subinquireditemcount: int - :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. - :paramtype sub_workload_item_count: int + :keyword subprotectableitemcount: For instance or AG, indicates number of DB's to be protected. + :paramtype subprotectableitemcount: int + :keyword prebackupvalidation: Pre-backup validation for protectable objects. + :paramtype prebackupvalidation: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSAPHanaDatabaseWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, server_name=server_name, is_auto_protectable=is_auto_protectable, subinquireditemcount=subinquireditemcount, sub_workload_item_count=sub_workload_item_count, **kwargs) - self.workload_item_type = 'SAPHanaDatabase' # type: str - - -class AzureVmWorkloadSAPHanaSystemProtectableItem(AzureVmWorkloadProtectableItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SAPHanaHSR" # type: str + + +class AzureVmWorkloadSAPHanaSystemProtectableItem( + AzureVmWorkloadProtectableItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item representing SAP HANA System. All required parameters must be populated in order to send to Azure. @@ -7156,12 +8095,12 @@ class AzureVmWorkloadSAPHanaSystemProtectableItem(AzureVmWorkloadProtectableItem :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7186,23 +8125,23 @@ class AzureVmWorkloadSAPHanaSystemProtectableItem(AzureVmWorkloadProtectableItem """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -7211,7 +8150,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -7219,7 +8158,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -7229,8 +8168,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7253,8 +8192,22 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSAPHanaSystemProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, parent_unique_name=parent_unique_name, server_name=server_name, is_auto_protectable=is_auto_protectable, is_auto_protected=is_auto_protected, subinquireditemcount=subinquireditemcount, subprotectableitemcount=subprotectableitemcount, prebackupvalidation=prebackupvalidation, **kwargs) - self.protectable_item_type = 'SAPHanaSystem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SAPHanaSystem" # type: str class AzureVmWorkloadSAPHanaSystemWorkloadItem(AzureVmWorkloadItem): @@ -7266,12 +8219,12 @@ class AzureVmWorkloadSAPHanaSystemWorkloadItem(AzureVmWorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7287,20 +8240,20 @@ class AzureVmWorkloadSAPHanaSystemWorkloadItem(AzureVmWorkloadItem): """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, } def __init__( @@ -7309,7 +8262,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, @@ -7324,8 +8277,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7339,11 +8292,24 @@ def __init__( :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. :paramtype sub_workload_item_count: int """ - super(AzureVmWorkloadSAPHanaSystemWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, server_name=server_name, is_auto_protectable=is_auto_protectable, subinquireditemcount=subinquireditemcount, sub_workload_item_count=sub_workload_item_count, **kwargs) - self.workload_item_type = 'SAPHanaSystem' # type: str - - -class AzureVmWorkloadSQLAvailabilityGroupProtectableItem(AzureVmWorkloadProtectableItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + subinquireditemcount=subinquireditemcount, + sub_workload_item_count=sub_workload_item_count, + **kwargs + ) + self.workload_item_type = "SAPHanaSystem" # type: str + + +class AzureVmWorkloadSQLAvailabilityGroupProtectableItem( + AzureVmWorkloadProtectableItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item representing SQL Availability Group. All required parameters must be populated in order to send to Azure. @@ -7352,12 +8318,12 @@ class AzureVmWorkloadSQLAvailabilityGroupProtectableItem(AzureVmWorkloadProtecta :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7382,23 +8348,23 @@ class AzureVmWorkloadSQLAvailabilityGroupProtectableItem(AzureVmWorkloadProtecta """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -7407,7 +8373,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -7415,7 +8381,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -7425,8 +8391,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7449,11 +8415,27 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSQLAvailabilityGroupProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, parent_unique_name=parent_unique_name, server_name=server_name, is_auto_protectable=is_auto_protectable, is_auto_protected=is_auto_protected, subinquireditemcount=subinquireditemcount, subprotectableitemcount=subprotectableitemcount, prebackupvalidation=prebackupvalidation, **kwargs) - self.protectable_item_type = 'SQLAvailabilityGroupContainer' # type: str - - -class AzureVmWorkloadSQLDatabaseProtectableItem(AzureVmWorkloadProtectableItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SQLAvailabilityGroupContainer" # type: str + + +class AzureVmWorkloadSQLDatabaseProtectableItem( + AzureVmWorkloadProtectableItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item representing SQL Database. All required parameters must be populated in order to send to Azure. @@ -7462,12 +8444,12 @@ class AzureVmWorkloadSQLDatabaseProtectableItem(AzureVmWorkloadProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7492,23 +8474,23 @@ class AzureVmWorkloadSQLDatabaseProtectableItem(AzureVmWorkloadProtectableItem): """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -7517,7 +8499,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -7525,7 +8507,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -7535,8 +8517,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7559,26 +8541,44 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSQLDatabaseProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, parent_unique_name=parent_unique_name, server_name=server_name, is_auto_protectable=is_auto_protectable, is_auto_protected=is_auto_protected, subinquireditemcount=subinquireditemcount, subprotectableitemcount=subprotectableitemcount, prebackupvalidation=prebackupvalidation, **kwargs) - self.protectable_item_type = 'SQLDataBase' # type: str - - -class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SQLDataBase" # type: str + + +class AzureVmWorkloadSQLDatabaseProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item representing SQL Database. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -7593,7 +8593,7 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -7626,12 +8626,12 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -7642,7 +8642,7 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus @@ -7655,53 +8655,55 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + "friendly_name": {"readonly": True}, + "protection_status": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -7710,33 +8712,20 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, - friendly_name: Optional[str] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, - protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -7749,7 +8738,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -7772,8 +8761,6 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str - :keyword friendly_name: Friendly name of the DB represented by this backup item. - :paramtype friendly_name: str :keyword server_name: Host/Cluster Name for instance or AG. :paramtype server_name: str :keyword parent_name: Parent name of the DB such as Instance or Availability Group. @@ -7781,15 +8768,12 @@ def __init__( :keyword parent_type: Parent type of protected item, example: for a DB, standalone server or distributed. :paramtype parent_type: str - :keyword protection_status: Backup status of this backup item. - :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -7800,8 +8784,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -7811,8 +8795,35 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSQLDatabaseProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, friendly_name=friendly_name, server_name=server_name, parent_name=parent_name, parent_type=parent_type, protection_status=protection_status, protection_state=protection_state, last_backup_status=last_backup_status, last_backup_time=last_backup_time, last_backup_error_detail=last_backup_error_detail, protected_item_data_source_id=protected_item_data_source_id, protected_item_health_status=protected_item_health_status, extended_info=extended_info, kpis_healths=kpis_healths, **kwargs) - self.protected_item_type = 'AzureVmWorkloadSQLDatabase' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSQLDatabase" # type: str class AzureVmWorkloadSQLDatabaseWorkloadItem(AzureVmWorkloadItem): @@ -7824,12 +8835,12 @@ class AzureVmWorkloadSQLDatabaseWorkloadItem(AzureVmWorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7845,20 +8856,20 @@ class AzureVmWorkloadSQLDatabaseWorkloadItem(AzureVmWorkloadItem): """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, } def __init__( @@ -7867,7 +8878,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, @@ -7882,8 +8893,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7897,11 +8908,24 @@ def __init__( :keyword sub_workload_item_count: For instance or AG, indicates number of DB's to be protected. :paramtype sub_workload_item_count: int """ - super(AzureVmWorkloadSQLDatabaseWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, server_name=server_name, is_auto_protectable=is_auto_protectable, subinquireditemcount=subinquireditemcount, sub_workload_item_count=sub_workload_item_count, **kwargs) - self.workload_item_type = 'SQLDataBase' # type: str - - -class AzureVmWorkloadSQLInstanceProtectableItem(AzureVmWorkloadProtectableItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + subinquireditemcount=subinquireditemcount, + sub_workload_item_count=sub_workload_item_count, + **kwargs + ) + self.workload_item_type = "SQLDataBase" # type: str + + +class AzureVmWorkloadSQLInstanceProtectableItem( + AzureVmWorkloadProtectableItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protectable item representing SQL Instance. All required parameters must be populated in order to send to Azure. @@ -7910,12 +8934,12 @@ class AzureVmWorkloadSQLInstanceProtectableItem(AzureVmWorkloadProtectableItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar protectable_item_type: Required. Type of the backup item.Constant filled by server. + :ivar protectable_item_type: Type of the backup item. Required. :vartype protectable_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7940,23 +8964,23 @@ class AzureVmWorkloadSQLInstanceProtectableItem(AzureVmWorkloadProtectableItem): """ _validation = { - 'protectable_item_type': {'required': True}, + "protectable_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protectable_item_type': {'key': 'protectableItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_unique_name': {'key': 'parentUniqueName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'is_auto_protected': {'key': 'isAutoProtected', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'subprotectableitemcount': {'key': 'subprotectableitemcount', 'type': 'int'}, - 'prebackupvalidation': {'key': 'prebackupvalidation', 'type': 'PreBackupValidation'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protectable_item_type": {"key": "protectableItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_unique_name": {"key": "parentUniqueName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "is_auto_protected": {"key": "isAutoProtected", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "subprotectableitemcount": {"key": "subprotectableitemcount", "type": "int"}, + "prebackupvalidation": {"key": "prebackupvalidation", "type": "PreBackupValidation"}, } def __init__( @@ -7965,7 +8989,7 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, parent_unique_name: Optional[str] = None, server_name: Optional[str] = None, @@ -7973,7 +8997,7 @@ def __init__( is_auto_protected: Optional[bool] = None, subinquireditemcount: Optional[int] = None, subprotectableitemcount: Optional[int] = None, - prebackupvalidation: Optional["PreBackupValidation"] = None, + prebackupvalidation: Optional["_models.PreBackupValidation"] = None, **kwargs ): """ @@ -7983,8 +9007,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -8007,11 +9031,25 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSQLInstanceProtectableItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, parent_unique_name=parent_unique_name, server_name=server_name, is_auto_protectable=is_auto_protectable, is_auto_protected=is_auto_protected, subinquireditemcount=subinquireditemcount, subprotectableitemcount=subprotectableitemcount, prebackupvalidation=prebackupvalidation, **kwargs) - self.protectable_item_type = 'SQLInstance' # type: str - - -class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + parent_unique_name=parent_unique_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + is_auto_protected=is_auto_protected, + subinquireditemcount=subinquireditemcount, + subprotectableitemcount=subprotectableitemcount, + prebackupvalidation=prebackupvalidation, + **kwargs + ) + self.protectable_item_type = "SQLInstance" # type: str + + +class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific workload item representing SQL Instance. All required parameters must be populated in order to send to Azure. @@ -8020,12 +9058,12 @@ class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): :vartype backup_management_type: str :ivar workload_type: Type of workload for the backup management. :vartype workload_type: str - :ivar workload_item_type: Required. Type of the backup item.Constant filled by server. + :ivar workload_item_type: Type of the backup item. Required. :vartype workload_item_type: str :ivar friendly_name: Friendly name of the backup item. :vartype friendly_name: str - :ivar protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: State of the back up item. Known values are: "Invalid", "NotProtected", + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -8044,21 +9082,21 @@ class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): """ _validation = { - 'workload_item_type': {'required': True}, + "workload_item_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'is_auto_protectable': {'key': 'isAutoProtectable', 'type': 'bool'}, - 'subinquireditemcount': {'key': 'subinquireditemcount', 'type': 'int'}, - 'sub_workload_item_count': {'key': 'subWorkloadItemCount', 'type': 'int'}, - 'data_directory_paths': {'key': 'dataDirectoryPaths', 'type': '[SQLDataDirectory]'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "is_auto_protectable": {"key": "isAutoProtectable", "type": "bool"}, + "subinquireditemcount": {"key": "subinquireditemcount", "type": "int"}, + "sub_workload_item_count": {"key": "subWorkloadItemCount", "type": "int"}, + "data_directory_paths": {"key": "dataDirectoryPaths", "type": "[SQLDataDirectory]"}, } def __init__( @@ -8067,13 +9105,13 @@ def __init__( backup_management_type: Optional[str] = None, workload_type: Optional[str] = None, friendly_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, parent_name: Optional[str] = None, server_name: Optional[str] = None, is_auto_protectable: Optional[bool] = None, subinquireditemcount: Optional[int] = None, sub_workload_item_count: Optional[int] = None, - data_directory_paths: Optional[List["SQLDataDirectory"]] = None, + data_directory_paths: Optional[List["_models.SQLDataDirectory"]] = None, **kwargs ): """ @@ -8083,8 +9121,8 @@ def __init__( :paramtype workload_type: str :keyword friendly_name: Friendly name of the backup item. :paramtype friendly_name: str - :keyword protection_state: State of the back up item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: State of the back up item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -8101,28 +9139,39 @@ def __init__( :paramtype data_directory_paths: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectory] """ - super(AzureVmWorkloadSQLInstanceWorkloadItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, friendly_name=friendly_name, protection_state=protection_state, parent_name=parent_name, server_name=server_name, is_auto_protectable=is_auto_protectable, subinquireditemcount=subinquireditemcount, sub_workload_item_count=sub_workload_item_count, **kwargs) - self.workload_item_type = 'SQLInstance' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + friendly_name=friendly_name, + protection_state=protection_state, + parent_name=parent_name, + server_name=server_name, + is_auto_protectable=is_auto_protectable, + subinquireditemcount=subinquireditemcount, + sub_workload_item_count=sub_workload_item_count, + **kwargs + ) + self.workload_item_type = "SQLInstance" # type: str self.data_directory_paths = data_directory_paths class AzureWorkloadAutoProtectionIntent(AzureRecoveryServiceVaultProtectionIntent): """Azure Recovery Services Vault specific protection intent item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSQLAutoProtectionIntent. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSQLAutoProtectionIntent All required parameters must be populated in order to send to Azure. - :ivar protection_intent_item_type: Required. backup protectionIntent type.Constant filled by - server. Possible values include: "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", - "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", + :ivar protection_intent_item_type: backup protectionIntent type. Required. Known values are: + "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", + "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", and "AzureWorkloadSQLAutoProtectionIntent". :vartype protection_intent_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentItemType - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar source_resource_id: ARM ID of the resource to be backed up. @@ -8132,43 +9181,43 @@ class AzureWorkloadAutoProtectionIntent(AzureRecoveryServiceVaultProtectionInten :vartype item_id: str :ivar policy_id: ID of the backup policy with which this item is backed up. :vartype policy_id: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _validation = { - 'protection_intent_item_type': {'required': True}, + "protection_intent_item_type": {"required": True}, } _attribute_map = { - 'protection_intent_item_type': {'key': 'protectionIntentItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'item_id': {'key': 'itemId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, + "protection_intent_item_type": {"key": "protectionIntentItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "item_id": {"key": "itemId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, } _subtype_map = { - 'protection_intent_item_type': {'AzureWorkloadSQLAutoProtectionIntent': 'AzureWorkloadSQLAutoProtectionIntent'} + "protection_intent_item_type": {"AzureWorkloadSQLAutoProtectionIntent": "AzureWorkloadSQLAutoProtectionIntent"} } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, source_resource_id: Optional[str] = None, item_id: Optional[str] = None, policy_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -8178,13 +9227,20 @@ def __init__( :paramtype item_id: str :keyword policy_id: ID of the backup policy with which this item is backed up. :paramtype policy_id: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(AzureWorkloadAutoProtectionIntent, self).__init__(backup_management_type=backup_management_type, source_resource_id=source_resource_id, item_id=item_id, policy_id=policy_id, protection_state=protection_state, **kwargs) - self.protection_intent_item_type = 'AzureWorkloadAutoProtectionIntent' # type: str + super().__init__( + backup_management_type=backup_management_type, + source_resource_id=source_resource_id, + item_id=item_id, + policy_id=policy_id, + protection_state=protection_state, + **kwargs + ) + self.protection_intent_item_type = "AzureWorkloadAutoProtectionIntent" # type: str class AzureWorkloadBackupRequest(BackupRequest): @@ -8192,11 +9248,12 @@ class AzureWorkloadBackupRequest(BackupRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar backup_type: Type of backup, viz. Full, Differential, Log or CopyOnlyFull. Possible - values include: "Invalid", "Full", "Differential", "Log", "CopyOnlyFull", "Incremental". + :ivar backup_type: Type of backup, viz. Full, Differential, Log or CopyOnlyFull. Known values + are: "Invalid", "Full", "Differential", "Log", "CopyOnlyFull", "Incremental", "SnapshotFull", + and "SnapshotCopyOnlyFull". :vartype backup_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupType :ivar enable_compression: Bool for Compression setting. :vartype enable_compression: bool @@ -8206,27 +9263,28 @@ class AzureWorkloadBackupRequest(BackupRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'backup_type': {'key': 'backupType', 'type': 'str'}, - 'enable_compression': {'key': 'enableCompression', 'type': 'bool'}, - 'recovery_point_expiry_time_in_utc': {'key': 'recoveryPointExpiryTimeInUTC', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "backup_type": {"key": "backupType", "type": "str"}, + "enable_compression": {"key": "enableCompression", "type": "bool"}, + "recovery_point_expiry_time_in_utc": {"key": "recoveryPointExpiryTimeInUTC", "type": "iso-8601"}, } def __init__( self, *, - backup_type: Optional[Union[str, "BackupType"]] = None, + backup_type: Optional[Union[str, "_models.BackupType"]] = None, enable_compression: Optional[bool] = None, recovery_point_expiry_time_in_utc: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword backup_type: Type of backup, viz. Full, Differential, Log or CopyOnlyFull. Possible - values include: "Invalid", "Full", "Differential", "Log", "CopyOnlyFull", "Incremental". + :keyword backup_type: Type of backup, viz. Full, Differential, Log or CopyOnlyFull. Known + values are: "Invalid", "Full", "Differential", "Log", "CopyOnlyFull", "Incremental", + "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype backup_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupType :keyword enable_compression: Bool for Compression setting. :paramtype enable_compression: bool @@ -8234,8 +9292,8 @@ def __init__( (UTC). :paramtype recovery_point_expiry_time_in_utc: ~datetime.datetime """ - super(AzureWorkloadBackupRequest, self).__init__(**kwargs) - self.object_type = 'AzureWorkloadBackupRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureWorkloadBackupRequest" # type: str self.backup_type = backup_type self.enable_compression = enable_compression self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc @@ -8246,15 +9304,15 @@ class AzureWorkloadContainerAutoProtectionIntent(ProtectionIntent): All required parameters must be populated in order to send to Azure. - :ivar protection_intent_item_type: Required. backup protectionIntent type.Constant filled by - server. Possible values include: "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", - "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", + :ivar protection_intent_item_type: backup protectionIntent type. Required. Known values are: + "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", + "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", and "AzureWorkloadSQLAutoProtectionIntent". :vartype protection_intent_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentItemType - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar source_resource_id: ARM ID of the resource to be backed up. @@ -8264,39 +9322,39 @@ class AzureWorkloadContainerAutoProtectionIntent(ProtectionIntent): :vartype item_id: str :ivar policy_id: ID of the backup policy with which this item is backed up. :vartype policy_id: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _validation = { - 'protection_intent_item_type': {'required': True}, + "protection_intent_item_type": {"required": True}, } _attribute_map = { - 'protection_intent_item_type': {'key': 'protectionIntentItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'item_id': {'key': 'itemId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, + "protection_intent_item_type": {"key": "protectionIntentItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "item_id": {"key": "itemId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, source_resource_id: Optional[str] = None, item_id: Optional[str] = None, policy_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -8306,16 +9364,23 @@ def __init__( :paramtype item_id: str :keyword policy_id: ID of the backup policy with which this item is backed up. :paramtype policy_id: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(AzureWorkloadContainerAutoProtectionIntent, self).__init__(backup_management_type=backup_management_type, source_resource_id=source_resource_id, item_id=item_id, policy_id=policy_id, protection_state=protection_state, **kwargs) - self.protection_intent_item_type = 'AzureWorkloadContainerAutoProtectionIntent' # type: str + super().__init__( + backup_management_type=backup_management_type, + source_resource_id=source_resource_id, + item_id=item_id, + policy_id=policy_id, + protection_state=protection_state, + **kwargs + ) + self.protection_intent_item_type = "AzureWorkloadContainerAutoProtectionIntent" # type: str -class AzureWorkloadContainerExtendedInfo(msrest.serialization.Model): +class AzureWorkloadContainerExtendedInfo(_serialization.Model): """Extended information of the container. :ivar host_server_name: Host Os Name in case of Stand Alone and Cluster Name in case of @@ -8329,17 +9394,17 @@ class AzureWorkloadContainerExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'host_server_name': {'key': 'hostServerName', 'type': 'str'}, - 'inquiry_info': {'key': 'inquiryInfo', 'type': 'InquiryInfo'}, - 'nodes_list': {'key': 'nodesList', 'type': '[DistributedNodesInfo]'}, + "host_server_name": {"key": "hostServerName", "type": "str"}, + "inquiry_info": {"key": "inquiryInfo", "type": "InquiryInfo"}, + "nodes_list": {"key": "nodesList", "type": "[DistributedNodesInfo]"}, } def __init__( self, *, host_server_name: Optional[str] = None, - inquiry_info: Optional["InquiryInfo"] = None, - nodes_list: Optional[List["DistributedNodesInfo"]] = None, + inquiry_info: Optional["_models.InquiryInfo"] = None, + nodes_list: Optional[List["_models.DistributedNodesInfo"]] = None, **kwargs ): """ @@ -8352,13 +9417,13 @@ def __init__( :paramtype nodes_list: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.DistributedNodesInfo] """ - super(AzureWorkloadContainerExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.host_server_name = host_server_name self.inquiry_info = inquiry_info self.nodes_list = nodes_list -class AzureWorkloadErrorInfo(msrest.serialization.Model): +class AzureWorkloadErrorInfo(_serialization.Model): """Azure storage specific error information. :ivar error_code: Error code. @@ -8374,11 +9439,11 @@ class AzureWorkloadErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'error_title': {'key': 'errorTitle', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'additional_details': {'key': 'additionalDetails', 'type': 'str'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_string": {"key": "errorString", "type": "str"}, + "error_title": {"key": "errorTitle", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, + "additional_details": {"key": "additionalDetails", "type": "str"}, } def __init__( @@ -8403,7 +9468,7 @@ def __init__( :keyword additional_details: Additional details for above error code. :paramtype additional_details: str """ - super(AzureWorkloadErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_code = error_code self.error_string = error_string self.error_title = error_title @@ -8411,16 +9476,16 @@ def __init__( self.additional_details = additional_details -class AzureWorkloadJob(Job): +class AzureWorkloadJob(Job): # pylint: disable=too-many-instance-attributes """Azure storage specific job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -8433,8 +9498,8 @@ class AzureWorkloadJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar workload_type: Workload type of the job. :vartype workload_type: str @@ -8452,30 +9517,30 @@ class AzureWorkloadJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureWorkloadErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[AzureWorkloadErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, @@ -8483,18 +9548,18 @@ def __init__( activity_id: Optional[str] = None, workload_type: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["AzureWorkloadErrorInfo"]] = None, - extended_info: Optional["AzureWorkloadJobExtendedInfo"] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.AzureWorkloadErrorInfo"]] = None, + extended_info: Optional["_models.AzureWorkloadJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -8521,8 +9586,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadJobExtendedInfo """ - super(AzureWorkloadJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureWorkloadJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureWorkloadJob" # type: str self.workload_type = workload_type self.duration = duration self.actions_info = actions_info @@ -8530,7 +9604,7 @@ def __init__( self.extended_info = extended_info -class AzureWorkloadJobExtendedInfo(msrest.serialization.Model): +class AzureWorkloadJobExtendedInfo(_serialization.Model): """Azure VM workload-specific additional information for job. :ivar tasks_list: List of tasks for this job. @@ -8543,15 +9617,15 @@ class AzureWorkloadJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[AzureWorkloadJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[AzureWorkloadJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["AzureWorkloadJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.AzureWorkloadJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -8565,13 +9639,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(AzureWorkloadJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class AzureWorkloadJobTaskDetails(msrest.serialization.Model): +class AzureWorkloadJobTaskDetails(_serialization.Model): """Azure VM workload specific job task details. :ivar task_id: The task display name. @@ -8581,24 +9655,18 @@ class AzureWorkloadJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "status": {"key": "status", "type": "str"}, } - def __init__( - self, - *, - task_id: Optional[str] = None, - status: Optional[str] = None, - **kwargs - ): + def __init__(self, *, task_id: Optional[str] = None, status: Optional[str] = None, **kwargs): """ :keyword task_id: The task display name. :paramtype task_id: str :keyword status: The status. :paramtype status: str """ - super(AzureWorkloadJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.status = status @@ -8606,18 +9674,19 @@ def __init__( class AzureWorkloadRecoveryPoint(RecoveryPoint): """Workload specific recovery point, specifically encapsulates full/diff recovery point. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadPointInTimeRecoveryPoint, AzureWorkloadSAPHanaRecoveryPoint, AzureWorkloadSQLRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadPointInTimeRecoveryPoint, AzureWorkloadSAPHanaRecoveryPoint, + AzureWorkloadSQLRecoveryPoint All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -8628,35 +9697,42 @@ class AzureWorkloadRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, } _subtype_map = { - 'object_type': {'AzureWorkloadPointInTimeRecoveryPoint': 'AzureWorkloadPointInTimeRecoveryPoint', 'AzureWorkloadSAPHanaRecoveryPoint': 'AzureWorkloadSAPHanaRecoveryPoint', 'AzureWorkloadSQLRecoveryPoint': 'AzureWorkloadSQLRecoveryPoint'} + "object_type": { + "AzureWorkloadPointInTimeRecoveryPoint": "AzureWorkloadPointInTimeRecoveryPoint", + "AzureWorkloadSAPHanaRecoveryPoint": "AzureWorkloadSAPHanaRecoveryPoint", + "AzureWorkloadSQLRecoveryPoint": "AzureWorkloadSQLRecoveryPoint", + } } def __init__( self, *, recovery_point_time_in_utc: Optional[datetime.datetime] = None, - type: Optional[Union[str, "RestorePointType"]] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, + type: Optional[Union[str, "_models.RestorePointType"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, **kwargs ): """ :keyword recovery_point_time_in_utc: UTC time at which recovery point was created. :paramtype recovery_point_time_in_utc: ~datetime.datetime - :keyword type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :keyword type: Type of restore point. Known values are: "Invalid", "Full", "Log", + "Differential", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :keyword recovery_point_tier_details: Recovery point tier information. :paramtype recovery_point_tier_details: @@ -8665,8 +9741,8 @@ def __init__( :paramtype recovery_point_move_readiness_info: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointMoveReadinessInfo] """ - super(AzureWorkloadRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'AzureWorkloadRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "AzureWorkloadRecoveryPoint" # type: str self.recovery_point_time_in_utc = recovery_point_time_in_utc self.type = type self.recovery_point_tier_details = recovery_point_tier_details @@ -8676,18 +9752,18 @@ def __init__( class AzureWorkloadPointInTimeRecoveryPoint(AzureWorkloadRecoveryPoint): """Recovery point specific to PointInTime. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSAPHanaPointInTimeRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSAPHanaPointInTimeRecoveryPoint All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -8701,37 +9777,40 @@ class AzureWorkloadPointInTimeRecoveryPoint(AzureWorkloadRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[PointInTimeRange]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "time_ranges": {"key": "timeRanges", "type": "[PointInTimeRange]"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSAPHanaPointInTimeRecoveryPoint': 'AzureWorkloadSAPHanaPointInTimeRecoveryPoint'} + "object_type": {"AzureWorkloadSAPHanaPointInTimeRecoveryPoint": "AzureWorkloadSAPHanaPointInTimeRecoveryPoint"} } def __init__( self, *, recovery_point_time_in_utc: Optional[datetime.datetime] = None, - type: Optional[Union[str, "RestorePointType"]] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - time_ranges: Optional[List["PointInTimeRange"]] = None, + type: Optional[Union[str, "_models.RestorePointType"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + time_ranges: Optional[List["_models.PointInTimeRange"]] = None, **kwargs ): """ :keyword recovery_point_time_in_utc: UTC time at which recovery point was created. :paramtype recovery_point_time_in_utc: ~datetime.datetime - :keyword type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :keyword type: Type of restore point. Known values are: "Invalid", "Full", "Log", + "Differential", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :keyword recovery_point_tier_details: Recovery point tier information. :paramtype recovery_point_tier_details: @@ -8743,24 +9822,31 @@ def __init__( :paramtype time_ranges: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.PointInTimeRange] """ - super(AzureWorkloadPointInTimeRecoveryPoint, self).__init__(recovery_point_time_in_utc=recovery_point_time_in_utc, type=type, recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs) - self.object_type = 'AzureWorkloadPointInTimeRecoveryPoint' # type: str + super().__init__( + recovery_point_time_in_utc=recovery_point_time_in_utc, + type=type, + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + **kwargs + ) + self.object_type = "AzureWorkloadPointInTimeRecoveryPoint" # type: str self.time_ranges = time_ranges class AzureWorkloadRestoreRequest(RestoreRequest): """AzureWorkload-specific restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadPointInTimeRestoreRequest, AzureWorkloadSAPHanaRestoreRequest, AzureWorkloadSQLRestoreRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadPointInTimeRestoreRequest, AzureWorkloadSAPHanaRestoreRequest, + AzureWorkloadSQLRestoreRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -8771,7 +9857,7 @@ class AzureWorkloadRestoreRequest(RestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -8781,37 +9867,41 @@ class AzureWorkloadRestoreRequest(RestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureWorkloadPointInTimeRestoreRequest': 'AzureWorkloadPointInTimeRestoreRequest', 'AzureWorkloadSAPHanaRestoreRequest': 'AzureWorkloadSAPHanaRestoreRequest', 'AzureWorkloadSQLRestoreRequest': 'AzureWorkloadSQLRestoreRequest'} + "object_type": { + "AzureWorkloadPointInTimeRestoreRequest": "AzureWorkloadPointInTimeRestoreRequest", + "AzureWorkloadSAPHanaRestoreRequest": "AzureWorkloadSAPHanaRestoreRequest", + "AzureWorkloadSQLRestoreRequest": "AzureWorkloadSQLRestoreRequest", + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -8822,7 +9912,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -8830,8 +9920,8 @@ def __init__( /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}. :paramtype target_virtual_machine_id: str """ - super(AzureWorkloadRestoreRequest, self).__init__(**kwargs) - self.object_type = 'AzureWorkloadRestoreRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureWorkloadRestoreRequest" # type: str self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.property_bag = property_bag @@ -8845,11 +9935,11 @@ class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -8860,7 +9950,7 @@ class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -8872,35 +9962,35 @@ class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, point_in_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -8911,7 +10001,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -8921,8 +10011,16 @@ def __init__( :keyword point_in_time: PointInTime value. :paramtype point_in_time: ~datetime.datetime """ - super(AzureWorkloadPointInTimeRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadPointInTimeRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadPointInTimeRestoreRequest" # type: str self.point_in_time = point_in_time @@ -8931,13 +10029,13 @@ class AzureWorkloadSAPHanaPointInTimeRecoveryPoint(AzureWorkloadPointInTimeRecov All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -8951,33 +10049,36 @@ class AzureWorkloadSAPHanaPointInTimeRecoveryPoint(AzureWorkloadPointInTimeRecov """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[PointInTimeRange]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "time_ranges": {"key": "timeRanges", "type": "[PointInTimeRange]"}, } def __init__( self, *, recovery_point_time_in_utc: Optional[datetime.datetime] = None, - type: Optional[Union[str, "RestorePointType"]] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - time_ranges: Optional[List["PointInTimeRange"]] = None, + type: Optional[Union[str, "_models.RestorePointType"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + time_ranges: Optional[List["_models.PointInTimeRange"]] = None, **kwargs ): """ :keyword recovery_point_time_in_utc: UTC time at which recovery point was created. :paramtype recovery_point_time_in_utc: ~datetime.datetime - :keyword type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :keyword type: Type of restore point. Known values are: "Invalid", "Full", "Log", + "Differential", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :keyword recovery_point_tier_details: Recovery point tier information. :paramtype recovery_point_tier_details: @@ -8989,23 +10090,30 @@ def __init__( :paramtype time_ranges: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.PointInTimeRange] """ - super(AzureWorkloadSAPHanaPointInTimeRecoveryPoint, self).__init__(recovery_point_time_in_utc=recovery_point_time_in_utc, type=type, recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, time_ranges=time_ranges, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaPointInTimeRecoveryPoint' # type: str + super().__init__( + recovery_point_time_in_utc=recovery_point_time_in_utc, + type=type, + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + time_ranges=time_ranges, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" # type: str class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SAP Hana-specific restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSAPHanaPointInTimeRestoreRequest, AzureWorkloadSAPHanaRestoreWithRehydrateRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSAPHanaPointInTimeRestoreRequest, AzureWorkloadSAPHanaRestoreWithRehydrateRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9016,7 +10124,7 @@ class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9026,37 +10134,40 @@ class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSAPHanaPointInTimeRestoreRequest': 'AzureWorkloadSAPHanaPointInTimeRestoreRequest', 'AzureWorkloadSAPHanaRestoreWithRehydrateRequest': 'AzureWorkloadSAPHanaRestoreWithRehydrateRequest'} + "object_type": { + "AzureWorkloadSAPHanaPointInTimeRestoreRequest": "AzureWorkloadSAPHanaPointInTimeRestoreRequest", + "AzureWorkloadSAPHanaRestoreWithRehydrateRequest": "AzureWorkloadSAPHanaRestoreWithRehydrateRequest", + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9067,7 +10178,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9075,23 +10186,31 @@ def __init__( /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}. :paramtype target_virtual_machine_id: str """ - super(AzureWorkloadSAPHanaRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaRestoreRequest" # type: str class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreRequest): """AzureWorkload SAP Hana -specific restore. Specifically for PointInTime/Log restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9102,7 +10221,7 @@ class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreR :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9114,39 +10233,41 @@ class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreR """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest': 'AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest'} + "object_type": { + "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest": "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest" + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, point_in_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9157,7 +10278,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9167,8 +10288,16 @@ def __init__( :keyword point_in_time: PointInTime value. :paramtype point_in_time: ~datetime.datetime """ - super(AzureWorkloadSAPHanaPointInTimeRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaPointInTimeRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" # type: str self.point_in_time = point_in_time @@ -9177,11 +10306,11 @@ class AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest(AzureWorkloadSA All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9192,7 +10321,7 @@ class AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest(AzureWorkloadSA :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9207,37 +10336,40 @@ class AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest(AzureWorkloadSA """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, - 'recovery_point_rehydration_info': {'key': 'recoveryPointRehydrationInfo', 'type': 'RecoveryPointRehydrationInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, + "recovery_point_rehydration_info": { + "key": "recoveryPointRehydrationInfo", + "type": "RecoveryPointRehydrationInfo", + }, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, point_in_time: Optional[datetime.datetime] = None, - recovery_point_rehydration_info: Optional["RecoveryPointRehydrationInfo"] = None, + recovery_point_rehydration_info: Optional["_models.RecoveryPointRehydrationInfo"] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9248,7 +10380,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9261,8 +10393,17 @@ def __init__( :paramtype recovery_point_rehydration_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointRehydrationInfo """ - super(AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, point_in_time=point_in_time, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + point_in_time=point_in_time, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest" # type: str self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -9271,13 +10412,13 @@ class AzureWorkloadSAPHanaRecoveryPoint(AzureWorkloadRecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -9288,31 +10429,34 @@ class AzureWorkloadSAPHanaRecoveryPoint(AzureWorkloadRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, } def __init__( self, *, recovery_point_time_in_utc: Optional[datetime.datetime] = None, - type: Optional[Union[str, "RestorePointType"]] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, + type: Optional[Union[str, "_models.RestorePointType"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, **kwargs ): """ :keyword recovery_point_time_in_utc: UTC time at which recovery point was created. :paramtype recovery_point_time_in_utc: ~datetime.datetime - :keyword type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :keyword type: Type of restore point. Known values are: "Invalid", "Full", "Log", + "Differential", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :keyword recovery_point_tier_details: Recovery point tier information. :paramtype recovery_point_tier_details: @@ -9321,8 +10465,14 @@ def __init__( :paramtype recovery_point_move_readiness_info: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointMoveReadinessInfo] """ - super(AzureWorkloadSAPHanaRecoveryPoint, self).__init__(recovery_point_time_in_utc=recovery_point_time_in_utc, type=type, recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaRecoveryPoint' # type: str + super().__init__( + recovery_point_time_in_utc=recovery_point_time_in_utc, + type=type, + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaRecoveryPoint" # type: str class AzureWorkloadSAPHanaRestoreWithRehydrateRequest(AzureWorkloadSAPHanaRestoreRequest): @@ -9330,11 +10480,11 @@ class AzureWorkloadSAPHanaRestoreWithRehydrateRequest(AzureWorkloadSAPHanaRestor All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9345,7 +10495,7 @@ class AzureWorkloadSAPHanaRestoreWithRehydrateRequest(AzureWorkloadSAPHanaRestor :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9358,35 +10508,38 @@ class AzureWorkloadSAPHanaRestoreWithRehydrateRequest(AzureWorkloadSAPHanaRestor """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'recovery_point_rehydration_info': {'key': 'recoveryPointRehydrationInfo', 'type': 'RecoveryPointRehydrationInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "recovery_point_rehydration_info": { + "key": "recoveryPointRehydrationInfo", + "type": "RecoveryPointRehydrationInfo", + }, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, - recovery_point_rehydration_info: Optional["RecoveryPointRehydrationInfo"] = None, + recovery_point_rehydration_info: Optional["_models.RecoveryPointRehydrationInfo"] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9397,7 +10550,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9408,8 +10561,16 @@ def __init__( :paramtype recovery_point_rehydration_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointRehydrationInfo """ - super(AzureWorkloadSAPHanaRestoreWithRehydrateRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaRestoreWithRehydrateRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest" # type: str self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -9418,15 +10579,15 @@ class AzureWorkloadSQLAutoProtectionIntent(AzureWorkloadAutoProtectionIntent): All required parameters must be populated in order to send to Azure. - :ivar protection_intent_item_type: Required. backup protectionIntent type.Constant filled by - server. Possible values include: "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", - "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", + :ivar protection_intent_item_type: backup protectionIntent type. Required. Known values are: + "Invalid", "AzureResourceItem", "RecoveryServiceVaultItem", + "AzureWorkloadContainerAutoProtectionIntent", "AzureWorkloadAutoProtectionIntent", and "AzureWorkloadSQLAutoProtectionIntent". :vartype protection_intent_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentItemType - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar source_resource_id: ARM ID of the resource to be backed up. @@ -9436,46 +10597,46 @@ class AzureWorkloadSQLAutoProtectionIntent(AzureWorkloadAutoProtectionIntent): :vartype item_id: str :ivar policy_id: ID of the backup policy with which this item is backed up. :vartype policy_id: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus - :ivar workload_item_type: Workload item type of the item for which intent is to be set. - Possible values include: "Invalid", "SQLInstance", "SQLDataBase", "SAPHanaSystem", - "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase". + :ivar workload_item_type: Workload item type of the item for which intent is to be set. Known + values are: "Invalid", "SQLInstance", "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", + "SAPAseSystem", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemType """ _validation = { - 'protection_intent_item_type': {'required': True}, + "protection_intent_item_type": {"required": True}, } _attribute_map = { - 'protection_intent_item_type': {'key': 'protectionIntentItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'item_id': {'key': 'itemId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, + "protection_intent_item_type": {"key": "protectionIntentItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "item_id": {"key": "itemId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, source_resource_id: Optional[str] = None, item_id: Optional[str] = None, policy_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionStatus"]] = None, - workload_item_type: Optional[Union[str, "WorkloadItemType"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionStatus"]] = None, + workload_item_type: Optional[Union[str, "_models.WorkloadItemType"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -9485,36 +10646,43 @@ def __init__( :paramtype item_id: str :keyword policy_id: ID of the backup policy with which this item is backed up. :paramtype policy_id: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword workload_item_type: Workload item type of the item for which intent is to be set. - Possible values include: "Invalid", "SQLInstance", "SQLDataBase", "SAPHanaSystem", - "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase". + Known values are: "Invalid", "SQLInstance", "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", + "SAPAseSystem", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemType """ - super(AzureWorkloadSQLAutoProtectionIntent, self).__init__(backup_management_type=backup_management_type, source_resource_id=source_resource_id, item_id=item_id, policy_id=policy_id, protection_state=protection_state, **kwargs) - self.protection_intent_item_type = 'AzureWorkloadSQLAutoProtectionIntent' # type: str + super().__init__( + backup_management_type=backup_management_type, + source_resource_id=source_resource_id, + item_id=item_id, + policy_id=policy_id, + protection_state=protection_state, + **kwargs + ) + self.protection_intent_item_type = "AzureWorkloadSQLAutoProtectionIntent" # type: str self.workload_item_type = workload_item_type class AzureWorkloadSQLRecoveryPoint(AzureWorkloadRecoveryPoint): """SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with extended info. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSQLPointInTimeRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSQLPointInTimeRecoveryPoint All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -9531,37 +10699,40 @@ class AzureWorkloadSQLRecoveryPoint(AzureWorkloadRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadSQLRecoveryPointExtendedInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadSQLRecoveryPointExtendedInfo"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSQLPointInTimeRecoveryPoint': 'AzureWorkloadSQLPointInTimeRecoveryPoint'} + "object_type": {"AzureWorkloadSQLPointInTimeRecoveryPoint": "AzureWorkloadSQLPointInTimeRecoveryPoint"} } def __init__( self, *, recovery_point_time_in_utc: Optional[datetime.datetime] = None, - type: Optional[Union[str, "RestorePointType"]] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - extended_info: Optional["AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, + type: Optional[Union[str, "_models.RestorePointType"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + extended_info: Optional["_models.AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, **kwargs ): """ :keyword recovery_point_time_in_utc: UTC time at which recovery point was created. :paramtype recovery_point_time_in_utc: ~datetime.datetime - :keyword type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :keyword type: Type of restore point. Known values are: "Invalid", "Full", "Log", + "Differential", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :keyword recovery_point_tier_details: Recovery point tier information. :paramtype recovery_point_tier_details: @@ -9576,8 +10747,14 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureWorkloadSQLRecoveryPointExtendedInfo """ - super(AzureWorkloadSQLRecoveryPoint, self).__init__(recovery_point_time_in_utc=recovery_point_time_in_utc, type=type, recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs) - self.object_type = 'AzureWorkloadSQLRecoveryPoint' # type: str + super().__init__( + recovery_point_time_in_utc=recovery_point_time_in_utc, + type=type, + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + **kwargs + ) + self.object_type = "AzureWorkloadSQLRecoveryPoint" # type: str self.extended_info = extended_info @@ -9586,13 +10763,13 @@ class AzureWorkloadSQLPointInTimeRecoveryPoint(AzureWorkloadSQLRecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -9612,35 +10789,38 @@ class AzureWorkloadSQLPointInTimeRecoveryPoint(AzureWorkloadSQLRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadSQLRecoveryPointExtendedInfo'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[PointInTimeRange]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadSQLRecoveryPointExtendedInfo"}, + "time_ranges": {"key": "timeRanges", "type": "[PointInTimeRange]"}, } def __init__( self, *, recovery_point_time_in_utc: Optional[datetime.datetime] = None, - type: Optional[Union[str, "RestorePointType"]] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - extended_info: Optional["AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, - time_ranges: Optional[List["PointInTimeRange"]] = None, + type: Optional[Union[str, "_models.RestorePointType"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + extended_info: Optional["_models.AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, + time_ranges: Optional[List["_models.PointInTimeRange"]] = None, **kwargs ): """ :keyword recovery_point_time_in_utc: UTC time at which recovery point was created. :paramtype recovery_point_time_in_utc: ~datetime.datetime - :keyword type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :keyword type: Type of restore point. Known values are: "Invalid", "Full", "Log", + "Differential", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointType :keyword recovery_point_tier_details: Recovery point tier information. :paramtype recovery_point_tier_details: @@ -9658,24 +10838,31 @@ def __init__( :paramtype time_ranges: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.PointInTimeRange] """ - super(AzureWorkloadSQLPointInTimeRecoveryPoint, self).__init__(recovery_point_time_in_utc=recovery_point_time_in_utc, type=type, recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, extended_info=extended_info, **kwargs) - self.object_type = 'AzureWorkloadSQLPointInTimeRecoveryPoint' # type: str + super().__init__( + recovery_point_time_in_utc=recovery_point_time_in_utc, + type=type, + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + extended_info=extended_info, + **kwargs + ) + self.object_type = "AzureWorkloadSQLPointInTimeRecoveryPoint" # type: str self.time_ranges = time_ranges class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SQL -specific restore. Specifically for full/diff restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSQLPointInTimeRestoreRequest, AzureWorkloadSQLRestoreWithRehydrateRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSQLPointInTimeRestoreRequest, AzureWorkloadSQLRestoreWithRehydrateRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9686,7 +10873,7 @@ class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9705,43 +10892,46 @@ class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'should_use_alternate_target_location': {'key': 'shouldUseAlternateTargetLocation', 'type': 'bool'}, - 'is_non_recoverable': {'key': 'isNonRecoverable', 'type': 'bool'}, - 'alternate_directory_paths': {'key': 'alternateDirectoryPaths', 'type': '[SQLDataDirectoryMapping]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "should_use_alternate_target_location": {"key": "shouldUseAlternateTargetLocation", "type": "bool"}, + "is_non_recoverable": {"key": "isNonRecoverable", "type": "bool"}, + "alternate_directory_paths": {"key": "alternateDirectoryPaths", "type": "[SQLDataDirectoryMapping]"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSQLPointInTimeRestoreRequest': 'AzureWorkloadSQLPointInTimeRestoreRequest', 'AzureWorkloadSQLRestoreWithRehydrateRequest': 'AzureWorkloadSQLRestoreWithRehydrateRequest'} + "object_type": { + "AzureWorkloadSQLPointInTimeRestoreRequest": "AzureWorkloadSQLPointInTimeRestoreRequest", + "AzureWorkloadSQLRestoreWithRehydrateRequest": "AzureWorkloadSQLRestoreWithRehydrateRequest", + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, should_use_alternate_target_location: Optional[bool] = None, is_non_recoverable: Optional[bool] = None, - alternate_directory_paths: Optional[List["SQLDataDirectoryMapping"]] = None, + alternate_directory_paths: Optional[List["_models.SQLDataDirectoryMapping"]] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9752,7 +10942,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9769,26 +10959,36 @@ def __init__( :paramtype alternate_directory_paths: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectoryMapping] """ - super(AzureWorkloadSQLRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSQLRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSQLRestoreRequest" # type: str self.should_use_alternate_target_location = should_use_alternate_target_location self.is_non_recoverable = is_non_recoverable self.alternate_directory_paths = alternate_directory_paths -class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): +class AzureWorkloadSQLPointInTimeRestoreRequest( + AzureWorkloadSQLRestoreRequest +): # pylint: disable=too-many-instance-attributes """AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9799,7 +10999,7 @@ class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9820,45 +11020,47 @@ class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'should_use_alternate_target_location': {'key': 'shouldUseAlternateTargetLocation', 'type': 'bool'}, - 'is_non_recoverable': {'key': 'isNonRecoverable', 'type': 'bool'}, - 'alternate_directory_paths': {'key': 'alternateDirectoryPaths', 'type': '[SQLDataDirectoryMapping]'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "should_use_alternate_target_location": {"key": "shouldUseAlternateTargetLocation", "type": "bool"}, + "is_non_recoverable": {"key": "isNonRecoverable", "type": "bool"}, + "alternate_directory_paths": {"key": "alternateDirectoryPaths", "type": "[SQLDataDirectoryMapping]"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest': 'AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest'} + "object_type": { + "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest": "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest" + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, should_use_alternate_target_location: Optional[bool] = None, is_non_recoverable: Optional[bool] = None, - alternate_directory_paths: Optional[List["SQLDataDirectoryMapping"]] = None, + alternate_directory_paths: Optional[List["_models.SQLDataDirectoryMapping"]] = None, point_in_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9869,7 +11071,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9888,21 +11090,34 @@ def __init__( :keyword point_in_time: PointInTime value. :paramtype point_in_time: ~datetime.datetime """ - super(AzureWorkloadSQLPointInTimeRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, should_use_alternate_target_location=should_use_alternate_target_location, is_non_recoverable=is_non_recoverable, alternate_directory_paths=alternate_directory_paths, **kwargs) - self.object_type = 'AzureWorkloadSQLPointInTimeRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + should_use_alternate_target_location=should_use_alternate_target_location, + is_non_recoverable=is_non_recoverable, + alternate_directory_paths=alternate_directory_paths, + **kwargs + ) + self.object_type = "AzureWorkloadSQLPointInTimeRestoreRequest" # type: str self.point_in_time = point_in_time -class AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest(AzureWorkloadSQLPointInTimeRestoreRequest): +class AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest( + AzureWorkloadSQLPointInTimeRestoreRequest +): # pylint: disable=too-many-instance-attributes """AzureWorkload SQL-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -9913,7 +11128,7 @@ class AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest(AzureWorkloadSQLPoi :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -9937,43 +11152,46 @@ class AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest(AzureWorkloadSQLPoi """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'should_use_alternate_target_location': {'key': 'shouldUseAlternateTargetLocation', 'type': 'bool'}, - 'is_non_recoverable': {'key': 'isNonRecoverable', 'type': 'bool'}, - 'alternate_directory_paths': {'key': 'alternateDirectoryPaths', 'type': '[SQLDataDirectoryMapping]'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, - 'recovery_point_rehydration_info': {'key': 'recoveryPointRehydrationInfo', 'type': 'RecoveryPointRehydrationInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "should_use_alternate_target_location": {"key": "shouldUseAlternateTargetLocation", "type": "bool"}, + "is_non_recoverable": {"key": "isNonRecoverable", "type": "bool"}, + "alternate_directory_paths": {"key": "alternateDirectoryPaths", "type": "[SQLDataDirectoryMapping]"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, + "recovery_point_rehydration_info": { + "key": "recoveryPointRehydrationInfo", + "type": "RecoveryPointRehydrationInfo", + }, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, should_use_alternate_target_location: Optional[bool] = None, is_non_recoverable: Optional[bool] = None, - alternate_directory_paths: Optional[List["SQLDataDirectoryMapping"]] = None, + alternate_directory_paths: Optional[List["_models.SQLDataDirectoryMapping"]] = None, point_in_time: Optional[datetime.datetime] = None, - recovery_point_rehydration_info: Optional["RecoveryPointRehydrationInfo"] = None, + recovery_point_rehydration_info: Optional["_models.RecoveryPointRehydrationInfo"] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -9984,7 +11202,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -10006,12 +11224,24 @@ def __init__( :paramtype recovery_point_rehydration_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointRehydrationInfo """ - super(AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, should_use_alternate_target_location=should_use_alternate_target_location, is_non_recoverable=is_non_recoverable, alternate_directory_paths=alternate_directory_paths, point_in_time=point_in_time, **kwargs) - self.object_type = 'AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + should_use_alternate_target_location=should_use_alternate_target_location, + is_non_recoverable=is_non_recoverable, + alternate_directory_paths=alternate_directory_paths, + point_in_time=point_in_time, + **kwargs + ) + self.object_type = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest" # type: str self.recovery_point_rehydration_info = recovery_point_rehydration_info -class AzureWorkloadSQLRecoveryPointExtendedInfo(msrest.serialization.Model): +class AzureWorkloadSQLRecoveryPointExtendedInfo(_serialization.Model): """Extended info class details. :ivar data_directory_time_in_utc: UTC time at which data directory info was captured. @@ -10022,15 +11252,15 @@ class AzureWorkloadSQLRecoveryPointExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'data_directory_time_in_utc': {'key': 'dataDirectoryTimeInUTC', 'type': 'iso-8601'}, - 'data_directory_paths': {'key': 'dataDirectoryPaths', 'type': '[SQLDataDirectory]'}, + "data_directory_time_in_utc": {"key": "dataDirectoryTimeInUTC", "type": "iso-8601"}, + "data_directory_paths": {"key": "dataDirectoryPaths", "type": "[SQLDataDirectory]"}, } def __init__( self, *, data_directory_time_in_utc: Optional[datetime.datetime] = None, - data_directory_paths: Optional[List["SQLDataDirectory"]] = None, + data_directory_paths: Optional[List["_models.SQLDataDirectory"]] = None, **kwargs ): """ @@ -10040,21 +11270,23 @@ def __init__( :paramtype data_directory_paths: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectory] """ - super(AzureWorkloadSQLRecoveryPointExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.data_directory_time_in_utc = data_directory_time_in_utc self.data_directory_paths = data_directory_paths -class AzureWorkloadSQLRestoreWithRehydrateRequest(AzureWorkloadSQLRestoreRequest): +class AzureWorkloadSQLRestoreWithRehydrateRequest( + AzureWorkloadSQLRestoreRequest +): # pylint: disable=too-many-instance-attributes """AzureWorkload SQL-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -10065,7 +11297,7 @@ class AzureWorkloadSQLRestoreWithRehydrateRequest(AzureWorkloadSQLRestoreRequest :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -10087,41 +11319,44 @@ class AzureWorkloadSQLRestoreWithRehydrateRequest(AzureWorkloadSQLRestoreRequest """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'should_use_alternate_target_location': {'key': 'shouldUseAlternateTargetLocation', 'type': 'bool'}, - 'is_non_recoverable': {'key': 'isNonRecoverable', 'type': 'bool'}, - 'alternate_directory_paths': {'key': 'alternateDirectoryPaths', 'type': '[SQLDataDirectoryMapping]'}, - 'recovery_point_rehydration_info': {'key': 'recoveryPointRehydrationInfo', 'type': 'RecoveryPointRehydrationInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "should_use_alternate_target_location": {"key": "shouldUseAlternateTargetLocation", "type": "bool"}, + "is_non_recoverable": {"key": "isNonRecoverable", "type": "bool"}, + "alternate_directory_paths": {"key": "alternateDirectoryPaths", "type": "[SQLDataDirectoryMapping]"}, + "recovery_point_rehydration_info": { + "key": "recoveryPointRehydrationInfo", + "type": "RecoveryPointRehydrationInfo", + }, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, should_use_alternate_target_location: Optional[bool] = None, is_non_recoverable: Optional[bool] = None, - alternate_directory_paths: Optional[List["SQLDataDirectoryMapping"]] = None, - recovery_point_rehydration_info: Optional["RecoveryPointRehydrationInfo"] = None, + alternate_directory_paths: Optional[List["_models.SQLDataDirectoryMapping"]] = None, + recovery_point_rehydration_info: Optional["_models.RecoveryPointRehydrationInfo"] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -10132,7 +11367,7 @@ def __init__( :keyword target_info: Details of target database. :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -10152,12 +11387,23 @@ def __init__( :paramtype recovery_point_rehydration_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointRehydrationInfo """ - super(AzureWorkloadSQLRestoreWithRehydrateRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, should_use_alternate_target_location=should_use_alternate_target_location, is_non_recoverable=is_non_recoverable, alternate_directory_paths=alternate_directory_paths, **kwargs) - self.object_type = 'AzureWorkloadSQLRestoreWithRehydrateRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + should_use_alternate_target_location=should_use_alternate_target_location, + is_non_recoverable=is_non_recoverable, + alternate_directory_paths=alternate_directory_paths, + **kwargs + ) + self.object_type = "AzureWorkloadSQLRestoreWithRehydrateRequest" # type: str self.recovery_point_rehydration_info = recovery_point_rehydration_info -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """ARM Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -10171,25 +11417,25 @@ class Resource(msrest.serialization.Model): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, } def __init__( @@ -10203,12 +11449,12 @@ def __init__( """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -10231,7 +11477,7 @@ class BackupEngineBaseResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -10240,19 +11486,19 @@ class BackupEngineBaseResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupEngineBase'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupEngineBase"}, } def __init__( @@ -10261,24 +11507,24 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupEngineBase"] = None, + properties: Optional["_models.BackupEngineBase"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: BackupEngineBaseResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBase """ - super(BackupEngineBaseResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class ResourceList(msrest.serialization.Model): +class ResourceList(_serialization.Model): """Base for all lists of resources. :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page @@ -10287,21 +11533,16 @@ class ResourceList(msrest.serialization.Model): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, next_link: Optional[str] = None, **kwargs): """ :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. :paramtype next_link: str """ - super(ResourceList, self).__init__(**kwargs) + super().__init__(**kwargs) self.next_link = next_link @@ -10317,15 +11558,15 @@ class BackupEngineBaseResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BackupEngineBaseResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[BackupEngineBaseResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["BackupEngineBaseResource"]] = None, + value: Optional[List["_models.BackupEngineBaseResource"]] = None, **kwargs ): """ @@ -10336,11 +11577,11 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource] """ - super(BackupEngineBaseResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class BackupEngineExtendedInfo(msrest.serialization.Model): +class BackupEngineExtendedInfo(_serialization.Model): """Additional information on backup engine. :ivar database_name: Database name of backup engine. @@ -10362,14 +11603,14 @@ class BackupEngineExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'database_name': {'key': 'databaseName', 'type': 'str'}, - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'protected_servers_count': {'key': 'protectedServersCount', 'type': 'int'}, - 'disk_count': {'key': 'diskCount', 'type': 'int'}, - 'used_disk_space': {'key': 'usedDiskSpace', 'type': 'float'}, - 'available_disk_space': {'key': 'availableDiskSpace', 'type': 'float'}, - 'refreshed_at': {'key': 'refreshedAt', 'type': 'iso-8601'}, - 'azure_protected_instances': {'key': 'azureProtectedInstances', 'type': 'int'}, + "database_name": {"key": "databaseName", "type": "str"}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "protected_servers_count": {"key": "protectedServersCount", "type": "int"}, + "disk_count": {"key": "diskCount", "type": "int"}, + "used_disk_space": {"key": "usedDiskSpace", "type": "float"}, + "available_disk_space": {"key": "availableDiskSpace", "type": "float"}, + "refreshed_at": {"key": "refreshedAt", "type": "iso-8601"}, + "azure_protected_instances": {"key": "azureProtectedInstances", "type": "int"}, } def __init__( @@ -10403,7 +11644,7 @@ def __init__( :keyword azure_protected_instances: Protected instances in the backup engine. :paramtype azure_protected_instances: int """ - super(BackupEngineExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.database_name = database_name self.protected_items_count = protected_items_count self.protected_servers_count = protected_servers_count @@ -10414,60 +11655,60 @@ def __init__( self.azure_protected_instances = azure_protected_instances -class BackupManagementUsage(msrest.serialization.Model): +class BackupManagementUsage(_serialization.Model): """Backup management usages of a vault. - :ivar unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond". + :ivar unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", and "BytesPerSecond". :vartype unit: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.UsagesUnit :ivar quota_period: Quota period of usage. :vartype quota_period: str :ivar next_reset_time: Next reset time of usage. :vartype next_reset_time: ~datetime.datetime :ivar current_value: Current value of usage. - :vartype current_value: long + :vartype current_value: int :ivar limit: Limit of usage. - :vartype limit: long + :vartype limit: int :ivar name: Name of usage. :vartype name: ~azure.mgmt.recoveryservicesbackup.activestamp.models.NameInfo """ _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, - 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'NameInfo'}, + "unit": {"key": "unit", "type": "str"}, + "quota_period": {"key": "quotaPeriod", "type": "str"}, + "next_reset_time": {"key": "nextResetTime", "type": "iso-8601"}, + "current_value": {"key": "currentValue", "type": "int"}, + "limit": {"key": "limit", "type": "int"}, + "name": {"key": "name", "type": "NameInfo"}, } def __init__( self, *, - unit: Optional[Union[str, "UsagesUnit"]] = None, + unit: Optional[Union[str, "_models.UsagesUnit"]] = None, quota_period: Optional[str] = None, next_reset_time: Optional[datetime.datetime] = None, current_value: Optional[int] = None, limit: Optional[int] = None, - name: Optional["NameInfo"] = None, + name: Optional["_models.NameInfo"] = None, **kwargs ): """ - :keyword unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond". + :keyword unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", and "BytesPerSecond". :paramtype unit: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.UsagesUnit :keyword quota_period: Quota period of usage. :paramtype quota_period: str :keyword next_reset_time: Next reset time of usage. :paramtype next_reset_time: ~datetime.datetime :keyword current_value: Current value of usage. - :paramtype current_value: long + :paramtype current_value: int :keyword limit: Limit of usage. - :paramtype limit: long + :paramtype limit: int :keyword name: Name of usage. :paramtype name: ~azure.mgmt.recoveryservicesbackup.activestamp.models.NameInfo """ - super(BackupManagementUsage, self).__init__(**kwargs) + super().__init__(**kwargs) self.unit = unit self.quota_period = quota_period self.next_reset_time = next_reset_time @@ -10476,7 +11717,7 @@ def __init__( self.name = name -class BackupManagementUsageList(msrest.serialization.Model): +class BackupManagementUsageList(_serialization.Model): """Backup management usage for vault. :ivar value: The list of backup management usages for the given vault. @@ -10485,21 +11726,16 @@ class BackupManagementUsageList(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[BackupManagementUsage]'}, + "value": {"key": "value", "type": "[BackupManagementUsage]"}, } - def __init__( - self, - *, - value: Optional[List["BackupManagementUsage"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.BackupManagementUsage"]] = None, **kwargs): """ :keyword value: The list of backup management usages for the given vault. :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsage] """ - super(BackupManagementUsageList, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value @@ -10517,7 +11753,7 @@ class BackupRequestResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -10526,19 +11762,19 @@ class BackupRequestResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupRequest'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupRequest"}, } def __init__( @@ -10547,92 +11783,89 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupRequest"] = None, + properties: Optional["_models.BackupRequest"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: BackupRequestResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupRequest """ - super(BackupRequestResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class BackupResourceConfig(msrest.serialization.Model): +class BackupResourceConfig(_serialization.Model): """The resource storage details. - :ivar storage_model_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :ivar storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType - :ivar storage_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :ivar storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :ivar storage_type_state: Locked or Unlocked. Once a machine is registered against a resource, - the storageTypeState is always Locked. Possible values include: "Invalid", "Locked", - "Unlocked". + the storageTypeState is always Locked. Known values are: "Invalid", "Locked", and "Unlocked". :vartype storage_type_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageTypeState :ivar cross_region_restore_flag: Opt in details of Cross Region Restore feature. :vartype cross_region_restore_flag: bool - :ivar dedup_state: Vault Dedup state. Possible values include: "Invalid", "Enabled", - "Disabled". + :ivar dedup_state: Vault Dedup state. Known values are: "Invalid", "Enabled", and "Disabled". :vartype dedup_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DedupState - :ivar xcool_state: Vault x-cool state. Possible values include: "Invalid", "Enabled", - "Disabled". + :ivar xcool_state: Vault x-cool state. Known values are: "Invalid", "Enabled", and "Disabled". :vartype xcool_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.XcoolState """ _attribute_map = { - 'storage_model_type': {'key': 'storageModelType', 'type': 'str'}, - 'storage_type': {'key': 'storageType', 'type': 'str'}, - 'storage_type_state': {'key': 'storageTypeState', 'type': 'str'}, - 'cross_region_restore_flag': {'key': 'crossRegionRestoreFlag', 'type': 'bool'}, - 'dedup_state': {'key': 'dedupState', 'type': 'str'}, - 'xcool_state': {'key': 'xcoolState', 'type': 'str'}, + "storage_model_type": {"key": "storageModelType", "type": "str"}, + "storage_type": {"key": "storageType", "type": "str"}, + "storage_type_state": {"key": "storageTypeState", "type": "str"}, + "cross_region_restore_flag": {"key": "crossRegionRestoreFlag", "type": "bool"}, + "dedup_state": {"key": "dedupState", "type": "str"}, + "xcool_state": {"key": "xcoolState", "type": "str"}, } def __init__( self, *, - storage_model_type: Optional[Union[str, "StorageType"]] = None, - storage_type: Optional[Union[str, "StorageType"]] = None, - storage_type_state: Optional[Union[str, "StorageTypeState"]] = None, + storage_model_type: Optional[Union[str, "_models.StorageType"]] = None, + storage_type: Optional[Union[str, "_models.StorageType"]] = None, + storage_type_state: Optional[Union[str, "_models.StorageTypeState"]] = None, cross_region_restore_flag: Optional[bool] = None, - dedup_state: Optional[Union[str, "DedupState"]] = None, - xcool_state: Optional[Union[str, "XcoolState"]] = None, + dedup_state: Optional[Union[str, "_models.DedupState"]] = None, + xcool_state: Optional[Union[str, "_models.XcoolState"]] = None, **kwargs ): """ - :keyword storage_model_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :keyword storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType - :keyword storage_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :keyword storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :keyword storage_type_state: Locked or Unlocked. Once a machine is registered against a - resource, the storageTypeState is always Locked. Possible values include: "Invalid", "Locked", + resource, the storageTypeState is always Locked. Known values are: "Invalid", "Locked", and "Unlocked". :paramtype storage_type_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageTypeState :keyword cross_region_restore_flag: Opt in details of Cross Region Restore feature. :paramtype cross_region_restore_flag: bool - :keyword dedup_state: Vault Dedup state. Possible values include: "Invalid", "Enabled", + :keyword dedup_state: Vault Dedup state. Known values are: "Invalid", "Enabled", and "Disabled". :paramtype dedup_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DedupState - :keyword xcool_state: Vault x-cool state. Possible values include: "Invalid", "Enabled", + :keyword xcool_state: Vault x-cool state. Known values are: "Invalid", "Enabled", and "Disabled". :paramtype xcool_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.XcoolState """ - super(BackupResourceConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_model_type = storage_model_type self.storage_type = storage_type self.storage_type_state = storage_type_state @@ -10655,7 +11888,7 @@ class BackupResourceConfigResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -10664,19 +11897,19 @@ class BackupResourceConfigResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupResourceConfig'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupResourceConfig"}, } def __init__( @@ -10685,13 +11918,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupResourceConfig"] = None, + properties: Optional["_models.BackupResourceConfig"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -10699,70 +11932,67 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfig """ - super(BackupResourceConfigResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class BackupResourceEncryptionConfig(msrest.serialization.Model): +class BackupResourceEncryptionConfig(_serialization.Model): """BackupResourceEncryptionConfig. - :ivar encryption_at_rest_type: Encryption At Rest Type. Possible values include: "Invalid", - "MicrosoftManaged", "CustomerManaged". + :ivar encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", + "MicrosoftManaged", and "CustomerManaged". :vartype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :ivar key_uri: Key Vault Key URI. :vartype key_uri: str :ivar subscription_id: Key Vault Subscription Id. :vartype subscription_id: str - :ivar last_update_status: Possible values include: "Invalid", "NotEnabled", - "PartiallySucceeded", "PartiallyFailed", "Failed", "Succeeded", "Initialized", - "FirstInitialization". + :ivar last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :vartype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :ivar infrastructure_encryption_state: Possible values include: "Invalid", "Disabled", - "Enabled". + :ivar infrastructure_encryption_state: Known values are: "Invalid", "Disabled", and "Enabled". :vartype infrastructure_encryption_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InfrastructureEncryptionState """ _attribute_map = { - 'encryption_at_rest_type': {'key': 'encryptionAtRestType', 'type': 'str'}, - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'last_update_status': {'key': 'lastUpdateStatus', 'type': 'str'}, - 'infrastructure_encryption_state': {'key': 'infrastructureEncryptionState', 'type': 'str'}, + "encryption_at_rest_type": {"key": "encryptionAtRestType", "type": "str"}, + "key_uri": {"key": "keyUri", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "last_update_status": {"key": "lastUpdateStatus", "type": "str"}, + "infrastructure_encryption_state": {"key": "infrastructureEncryptionState", "type": "str"}, } def __init__( self, *, - encryption_at_rest_type: Optional[Union[str, "EncryptionAtRestType"]] = None, + encryption_at_rest_type: Optional[Union[str, "_models.EncryptionAtRestType"]] = None, key_uri: Optional[str] = None, subscription_id: Optional[str] = None, - last_update_status: Optional[Union[str, "LastUpdateStatus"]] = None, - infrastructure_encryption_state: Optional[Union[str, "InfrastructureEncryptionState"]] = None, + last_update_status: Optional[Union[str, "_models.LastUpdateStatus"]] = None, + infrastructure_encryption_state: Optional[Union[str, "_models.InfrastructureEncryptionState"]] = None, **kwargs ): """ - :keyword encryption_at_rest_type: Encryption At Rest Type. Possible values include: "Invalid", - "MicrosoftManaged", "CustomerManaged". + :keyword encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", + "MicrosoftManaged", and "CustomerManaged". :paramtype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :keyword key_uri: Key Vault Key URI. :paramtype key_uri: str :keyword subscription_id: Key Vault Subscription Id. :paramtype subscription_id: str - :keyword last_update_status: Possible values include: "Invalid", "NotEnabled", - "PartiallySucceeded", "PartiallyFailed", "Failed", "Succeeded", "Initialized", - "FirstInitialization". + :keyword last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :paramtype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :keyword infrastructure_encryption_state: Possible values include: "Invalid", "Disabled", + :keyword infrastructure_encryption_state: Known values are: "Invalid", "Disabled", and "Enabled". :paramtype infrastructure_encryption_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InfrastructureEncryptionState """ - super(BackupResourceEncryptionConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.encryption_at_rest_type = encryption_at_rest_type self.key_uri = key_uri self.subscription_id = subscription_id @@ -10773,21 +12003,19 @@ def __init__( class BackupResourceEncryptionConfigExtended(BackupResourceEncryptionConfig): """BackupResourceEncryptionConfigExtended. - :ivar encryption_at_rest_type: Encryption At Rest Type. Possible values include: "Invalid", - "MicrosoftManaged", "CustomerManaged". + :ivar encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", + "MicrosoftManaged", and "CustomerManaged". :vartype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :ivar key_uri: Key Vault Key URI. :vartype key_uri: str :ivar subscription_id: Key Vault Subscription Id. :vartype subscription_id: str - :ivar last_update_status: Possible values include: "Invalid", "NotEnabled", - "PartiallySucceeded", "PartiallyFailed", "Failed", "Succeeded", "Initialized", - "FirstInitialization". + :ivar last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :vartype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :ivar infrastructure_encryption_state: Possible values include: "Invalid", "Disabled", - "Enabled". + :ivar infrastructure_encryption_state: Known values are: "Invalid", "Disabled", and "Enabled". :vartype infrastructure_encryption_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InfrastructureEncryptionState :ivar user_assigned_identity: User Assigned Identity Id. @@ -10798,42 +12026,41 @@ class BackupResourceEncryptionConfigExtended(BackupResourceEncryptionConfig): """ _attribute_map = { - 'encryption_at_rest_type': {'key': 'encryptionAtRestType', 'type': 'str'}, - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'last_update_status': {'key': 'lastUpdateStatus', 'type': 'str'}, - 'infrastructure_encryption_state': {'key': 'infrastructureEncryptionState', 'type': 'str'}, - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - 'use_system_assigned_identity': {'key': 'useSystemAssignedIdentity', 'type': 'bool'}, + "encryption_at_rest_type": {"key": "encryptionAtRestType", "type": "str"}, + "key_uri": {"key": "keyUri", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "last_update_status": {"key": "lastUpdateStatus", "type": "str"}, + "infrastructure_encryption_state": {"key": "infrastructureEncryptionState", "type": "str"}, + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, + "use_system_assigned_identity": {"key": "useSystemAssignedIdentity", "type": "bool"}, } def __init__( self, *, - encryption_at_rest_type: Optional[Union[str, "EncryptionAtRestType"]] = None, + encryption_at_rest_type: Optional[Union[str, "_models.EncryptionAtRestType"]] = None, key_uri: Optional[str] = None, subscription_id: Optional[str] = None, - last_update_status: Optional[Union[str, "LastUpdateStatus"]] = None, - infrastructure_encryption_state: Optional[Union[str, "InfrastructureEncryptionState"]] = None, + last_update_status: Optional[Union[str, "_models.LastUpdateStatus"]] = None, + infrastructure_encryption_state: Optional[Union[str, "_models.InfrastructureEncryptionState"]] = None, user_assigned_identity: Optional[str] = None, use_system_assigned_identity: Optional[bool] = None, **kwargs ): """ - :keyword encryption_at_rest_type: Encryption At Rest Type. Possible values include: "Invalid", - "MicrosoftManaged", "CustomerManaged". + :keyword encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", + "MicrosoftManaged", and "CustomerManaged". :paramtype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :keyword key_uri: Key Vault Key URI. :paramtype key_uri: str :keyword subscription_id: Key Vault Subscription Id. :paramtype subscription_id: str - :keyword last_update_status: Possible values include: "Invalid", "NotEnabled", - "PartiallySucceeded", "PartiallyFailed", "Failed", "Succeeded", "Initialized", - "FirstInitialization". + :keyword last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :paramtype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :keyword infrastructure_encryption_state: Possible values include: "Invalid", "Disabled", + :keyword infrastructure_encryption_state: Known values are: "Invalid", "Disabled", and "Enabled". :paramtype infrastructure_encryption_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InfrastructureEncryptionState @@ -10843,7 +12070,14 @@ def __init__( or not. :paramtype use_system_assigned_identity: bool """ - super(BackupResourceEncryptionConfigExtended, self).__init__(encryption_at_rest_type=encryption_at_rest_type, key_uri=key_uri, subscription_id=subscription_id, last_update_status=last_update_status, infrastructure_encryption_state=infrastructure_encryption_state, **kwargs) + super().__init__( + encryption_at_rest_type=encryption_at_rest_type, + key_uri=key_uri, + subscription_id=subscription_id, + last_update_status=last_update_status, + infrastructure_encryption_state=infrastructure_encryption_state, + **kwargs + ) self.user_assigned_identity = user_assigned_identity self.use_system_assigned_identity = use_system_assigned_identity @@ -10862,7 +12096,7 @@ class BackupResourceEncryptionConfigExtendedResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -10872,19 +12106,19 @@ class BackupResourceEncryptionConfigExtendedResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupResourceEncryptionConfigExtended'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupResourceEncryptionConfigExtended"}, } def __init__( @@ -10893,13 +12127,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupResourceEncryptionConfigExtended"] = None, + properties: Optional["_models.BackupResourceEncryptionConfigExtended"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -10907,7 +12141,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigExtended """ - super(BackupResourceEncryptionConfigExtendedResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -10925,7 +12159,7 @@ class BackupResourceEncryptionConfigResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -10935,19 +12169,19 @@ class BackupResourceEncryptionConfigResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupResourceEncryptionConfig'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupResourceEncryptionConfig"}, } def __init__( @@ -10956,13 +12190,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupResourceEncryptionConfig"] = None, + properties: Optional["_models.BackupResourceEncryptionConfig"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -10970,31 +12204,30 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfig """ - super(BackupResourceEncryptionConfigResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class BackupResourceVaultConfig(msrest.serialization.Model): +class BackupResourceVaultConfig(_serialization.Model): """Backup resource vault config details. - :ivar storage_model_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :ivar storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType - :ivar storage_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :ivar storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :ivar storage_type_state: Locked or Unlocked. Once a machine is registered against a resource, - the storageTypeState is always Locked. Possible values include: "Invalid", "Locked", - "Unlocked". + the storageTypeState is always Locked. Known values are: "Invalid", "Locked", and "Unlocked". :vartype storage_type_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageTypeState - :ivar enhanced_security_state: Enabled or Disabled. Possible values include: "Invalid", - "Enabled", "Disabled". + :ivar enhanced_security_state: Enabled or Disabled. Known values are: "Invalid", "Enabled", and + "Disabled". :vartype enhanced_security_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EnhancedSecurityState - :ivar soft_delete_feature_state: Soft Delete feature state. Possible values include: "Invalid", - "Enabled", "Disabled". + :ivar soft_delete_feature_state: Soft Delete feature state. Known values are: "Invalid", + "Enabled", and "Disabled". :vartype soft_delete_feature_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SoftDeleteFeatureState :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. @@ -11004,47 +12237,47 @@ class BackupResourceVaultConfig(msrest.serialization.Model): """ _attribute_map = { - 'storage_model_type': {'key': 'storageModelType', 'type': 'str'}, - 'storage_type': {'key': 'storageType', 'type': 'str'}, - 'storage_type_state': {'key': 'storageTypeState', 'type': 'str'}, - 'enhanced_security_state': {'key': 'enhancedSecurityState', 'type': 'str'}, - 'soft_delete_feature_state': {'key': 'softDeleteFeatureState', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_soft_delete_feature_state_editable': {'key': 'isSoftDeleteFeatureStateEditable', 'type': 'bool'}, + "storage_model_type": {"key": "storageModelType", "type": "str"}, + "storage_type": {"key": "storageType", "type": "str"}, + "storage_type_state": {"key": "storageTypeState", "type": "str"}, + "enhanced_security_state": {"key": "enhancedSecurityState", "type": "str"}, + "soft_delete_feature_state": {"key": "softDeleteFeatureState", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_soft_delete_feature_state_editable": {"key": "isSoftDeleteFeatureStateEditable", "type": "bool"}, } def __init__( self, *, - storage_model_type: Optional[Union[str, "StorageType"]] = None, - storage_type: Optional[Union[str, "StorageType"]] = None, - storage_type_state: Optional[Union[str, "StorageTypeState"]] = None, - enhanced_security_state: Optional[Union[str, "EnhancedSecurityState"]] = None, - soft_delete_feature_state: Optional[Union[str, "SoftDeleteFeatureState"]] = None, + storage_model_type: Optional[Union[str, "_models.StorageType"]] = None, + storage_type: Optional[Union[str, "_models.StorageType"]] = None, + storage_type_state: Optional[Union[str, "_models.StorageTypeState"]] = None, + enhanced_security_state: Optional[Union[str, "_models.EnhancedSecurityState"]] = None, + soft_delete_feature_state: Optional[Union[str, "_models.SoftDeleteFeatureState"]] = None, resource_guard_operation_requests: Optional[List[str]] = None, is_soft_delete_feature_state_editable: Optional[bool] = None, **kwargs ): """ - :keyword storage_model_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :keyword storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType - :keyword storage_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :keyword storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :keyword storage_type_state: Locked or Unlocked. Once a machine is registered against a - resource, the storageTypeState is always Locked. Possible values include: "Invalid", "Locked", + resource, the storageTypeState is always Locked. Known values are: "Invalid", "Locked", and "Unlocked". :paramtype storage_type_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageTypeState - :keyword enhanced_security_state: Enabled or Disabled. Possible values include: "Invalid", - "Enabled", "Disabled". + :keyword enhanced_security_state: Enabled or Disabled. Known values are: "Invalid", "Enabled", + and "Disabled". :paramtype enhanced_security_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EnhancedSecurityState - :keyword soft_delete_feature_state: Soft Delete feature state. Possible values include: - "Invalid", "Enabled", "Disabled". + :keyword soft_delete_feature_state: Soft Delete feature state. Known values are: "Invalid", + "Enabled", and "Disabled". :paramtype soft_delete_feature_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SoftDeleteFeatureState :keyword resource_guard_operation_requests: ResourceGuard Operation Requests. @@ -11052,7 +12285,7 @@ def __init__( :keyword is_soft_delete_feature_state_editable: Is soft delete feature state editable. :paramtype is_soft_delete_feature_state_editable: bool """ - super(BackupResourceVaultConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_model_type = storage_model_type self.storage_type = storage_type self.storage_type_state = storage_type_state @@ -11076,7 +12309,7 @@ class BackupResourceVaultConfigResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -11086,19 +12319,19 @@ class BackupResourceVaultConfigResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupResourceVaultConfig'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupResourceVaultConfig"}, } def __init__( @@ -11107,13 +12340,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupResourceVaultConfig"] = None, + properties: Optional["_models.BackupResourceVaultConfig"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -11121,17 +12354,17 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfig """ - super(BackupResourceVaultConfigResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class BackupStatusRequest(msrest.serialization.Model): +class BackupStatusRequest(_serialization.Model): """BackupStatus request. - :ivar resource_type: Container Type - VM, SQLPaaS, DPM, AzureFileShare... Possible values - include: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", - "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :ivar resource_type: Container Type - VM, SQLPaaS, DPM, AzureFileShare... Known values are: + "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", + "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype resource_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar resource_id: Entire ARM resource id of the resource. @@ -11141,24 +12374,24 @@ class BackupStatusRequest(msrest.serialization.Model): """ _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'po_logical_name': {'key': 'poLogicalName', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "po_logical_name": {"key": "poLogicalName", "type": "str"}, } def __init__( self, *, - resource_type: Optional[Union[str, "DataSourceType"]] = None, + resource_type: Optional[Union[str, "_models.DataSourceType"]] = None, resource_id: Optional[str] = None, po_logical_name: Optional[str] = None, **kwargs ): """ - :keyword resource_type: Container Type - VM, SQLPaaS, DPM, AzureFileShare... Possible values - include: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", - "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword resource_type: Container Type - VM, SQLPaaS, DPM, AzureFileShare... Known values are: + "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", + "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype resource_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword resource_id: Entire ARM resource id of the resource. @@ -11166,22 +12399,22 @@ def __init__( :keyword po_logical_name: Protectable Item Logical Name. :paramtype po_logical_name: str """ - super(BackupStatusRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_type = resource_type self.resource_id = resource_id self.po_logical_name = po_logical_name -class BackupStatusResponse(msrest.serialization.Model): +class BackupStatusResponse(_serialization.Model): """BackupStatus response. - :ivar protection_status: Specifies whether the container is registered or not. Possible values - include: "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_status: Specifies whether the container is registered or not. Known values + are: "Invalid", "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar vault_id: Specifies the arm resource id of the vault. :vartype vault_id: str - :ivar fabric_name: Specifies the fabric name - Azure or AD. Possible values include: "Invalid", + :ivar fabric_name: Specifies the fabric name - Azure or AD. Known values are: "Invalid" and "Azure". :vartype fabric_name: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.FabricName :ivar container_name: Specifies the product specific container name. E.g. @@ -11201,23 +12434,23 @@ class BackupStatusResponse(msrest.serialization.Model): """ _attribute_map = { - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "vault_id": {"key": "vaultId", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "protected_item_name": {"key": "protectedItemName", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "policy_name": {"key": "policyName", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, } def __init__( self, *, - protection_status: Optional[Union[str, "ProtectionStatus"]] = None, + protection_status: Optional[Union[str, "_models.ProtectionStatus"]] = None, vault_id: Optional[str] = None, - fabric_name: Optional[Union[str, "FabricName"]] = None, + fabric_name: Optional[Union[str, "_models.FabricName"]] = None, container_name: Optional[str] = None, protected_item_name: Optional[str] = None, error_code: Optional[str] = None, @@ -11227,14 +12460,14 @@ def __init__( **kwargs ): """ - :keyword protection_status: Specifies whether the container is registered or not. Possible - values include: "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_status: Specifies whether the container is registered or not. Known values + are: "Invalid", "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword vault_id: Specifies the arm resource id of the vault. :paramtype vault_id: str - :keyword fabric_name: Specifies the fabric name - Azure or AD. Possible values include: - "Invalid", "Azure". + :keyword fabric_name: Specifies the fabric name - Azure or AD. Known values are: "Invalid" and + "Azure". :paramtype fabric_name: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.FabricName :keyword container_name: Specifies the product specific container name. E.g. iaasvmcontainer;iaasvmcontainer;csname;vmname. @@ -11251,7 +12484,7 @@ def __init__( :keyword registration_status: Container registration status. :paramtype registration_status: str """ - super(BackupStatusResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.protection_status = protection_status self.vault_id = vault_id self.fabric_name = fabric_name @@ -11263,7 +12496,7 @@ def __init__( self.registration_status = registration_status -class BEKDetails(msrest.serialization.Model): +class BEKDetails(_serialization.Model): """BEK is bitlocker encryption key. :ivar secret_url: Secret is BEK. @@ -11275,9 +12508,9 @@ class BEKDetails(msrest.serialization.Model): """ _attribute_map = { - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - 'secret_vault_id': {'key': 'secretVaultId', 'type': 'str'}, - 'secret_data': {'key': 'secretData', 'type': 'str'}, + "secret_url": {"key": "secretUrl", "type": "str"}, + "secret_vault_id": {"key": "secretVaultId", "type": "str"}, + "secret_data": {"key": "secretData", "type": "str"}, } def __init__( @@ -11296,13 +12529,13 @@ def __init__( :keyword secret_data: BEK data. :paramtype secret_data: str """ - super(BEKDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_url = secret_url self.secret_vault_id = secret_vault_id self.secret_data = secret_data -class BMSBackupEngineQueryObject(msrest.serialization.Model): +class BMSBackupEngineQueryObject(_serialization.Model): """Query parameters to fetch list of backup engines. :ivar expand: attribute to add extended info. @@ -11310,29 +12543,24 @@ class BMSBackupEngineQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'expand': {'key': 'expand', 'type': 'str'}, + "expand": {"key": "expand", "type": "str"}, } - def __init__( - self, - *, - expand: Optional[str] = None, - **kwargs - ): + def __init__(self, *, expand: Optional[str] = None, **kwargs): """ :keyword expand: attribute to add extended info. :paramtype expand: str """ - super(BMSBackupEngineQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.expand = expand -class BMSBackupEnginesQueryObject(msrest.serialization.Model): +class BMSBackupEnginesQueryObject(_serialization.Model): """Query parameters to fetch list of backup engines. - :ivar backup_management_type: Backup management type for the backup engine. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for the backup engine. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar friendly_name: Friendly name of the backup engine. @@ -11342,23 +12570,23 @@ class BMSBackupEnginesQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'expand': {'key': 'expand', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "expand": {"key": "expand", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, friendly_name: Optional[str] = None, expand: Optional[str] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type for the backup engine. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword friendly_name: Friendly name of the backup engine. @@ -11366,55 +12594,48 @@ def __init__( :keyword expand: Attribute to add extended info. :paramtype expand: str """ - super(BMSBackupEnginesQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.friendly_name = friendly_name self.expand = expand -class BMSBackupSummariesQueryObject(msrest.serialization.Model): +class BMSBackupSummariesQueryObject(_serialization.Model): """Query parameters to fetch backup summaries. - :ivar type: Backup management type for this container. Possible values include: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + :ivar type: Backup management type for this container. Known values are: "Invalid", + "BackupProtectedItemCountSummary", and "BackupProtectionContainerCountSummary". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.Type """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "Type"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): """ - :keyword type: Backup management type for this container. Possible values include: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + :keyword type: Backup management type for this container. Known values are: "Invalid", + "BackupProtectedItemCountSummary", and "BackupProtectionContainerCountSummary". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.Type """ - super(BMSBackupSummariesQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type -class BMSContainerQueryObject(msrest.serialization.Model): +class BMSContainerQueryObject(_serialization.Model): """The query filters that can be used with the list containers API. All required parameters must be populated in order to send to Azure. - :ivar backup_management_type: Required. Backup management type for this container. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for this container. Required. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar container_type: Type of container for filter. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", - "AzureWorkloadContainer". + :ivar container_type: Type of container for filter. Known values are: "Invalid", "Unknown", + "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", + "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", and "HanaHSRContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType :ivar backup_engine_name: Backup engine name. @@ -11428,23 +12649,23 @@ class BMSContainerQueryObject(msrest.serialization.Model): """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'backup_engine_name': {'key': 'backupEngineName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "backup_engine_name": {"key": "backupEngineName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, } def __init__( self, *, - backup_management_type: Union[str, "BackupManagementType"], - container_type: Optional[Union[str, "ContainerType"]] = None, + backup_management_type: Union[str, "_models.BackupManagementType"], + container_type: Optional[Union[str, "_models.ContainerType"]] = None, backup_engine_name: Optional[str] = None, fabric_name: Optional[str] = None, status: Optional[str] = None, @@ -11452,17 +12673,15 @@ def __init__( **kwargs ): """ - :keyword backup_management_type: Required. Backup management type for this container. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for this container. Required. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword container_type: Type of container for filter. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", - "AzureWorkloadContainer". + :keyword container_type: Type of container for filter. Known values are: "Invalid", "Unknown", + "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", + "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", and "HanaHSRContainer". :paramtype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType :keyword backup_engine_name: Backup engine name. @@ -11474,7 +12693,7 @@ def __init__( :keyword friendly_name: Friendly name of this container. :paramtype friendly_name: str """ - super(BMSContainerQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.container_type = container_type self.backup_engine_name = backup_engine_name @@ -11483,63 +12702,64 @@ def __init__( self.friendly_name = friendly_name -class BMSContainersInquiryQueryObject(msrest.serialization.Model): +class BMSContainersInquiryQueryObject(_serialization.Model): """The query filters that can be used with the inquire container API. - :ivar backup_management_type: Backup management type for this container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for this container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Workload type for this container. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Workload type for this container. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type for this container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for this container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Workload type for this container. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :keyword workload_type: Workload type for this container. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType """ - super(BMSContainersInquiryQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_type = workload_type -class BMSPOQueryObject(msrest.serialization.Model): +class BMSPOQueryObject(_serialization.Model): """Filters to list items that can be backed up. - :ivar backup_management_type: Backup management type. Possible values include: "Invalid", + :ivar backup_management_type: Backup management type. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", "AzureWorkload", - "DefaultBackup". + and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Workload type. Possible values include: "Invalid", "VM", "FileFolder", + :ivar workload_type: Workload type. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", - "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase". + "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase", and + "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :ivar container_name: Full name of the container whose Protectable Objects should be returned. @@ -11551,32 +12771,33 @@ class BMSPOQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, container_name: Optional[str] = None, status: Optional[str] = None, friendly_name: Optional[str] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type. Possible values include: "Invalid", + :keyword backup_management_type: Backup management type. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", "AzureWorkload", - "DefaultBackup". + and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Workload type. Possible values include: "Invalid", "VM", "FileFolder", + :keyword workload_type: Workload type. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", - "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase". + "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase", and + "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :keyword container_name: Full name of the container whose Protectable Objects should be @@ -11587,7 +12808,7 @@ def __init__( :keyword friendly_name: Friendly name. :paramtype friendly_name: str """ - super(BMSPOQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_type = workload_type self.container_name = container_name @@ -11595,46 +12816,44 @@ def __init__( self.friendly_name = friendly_name -class BMSRefreshContainersQueryObject(msrest.serialization.Model): +class BMSRefreshContainersQueryObject(_serialization.Model): """The query filters that can be used with the refresh container API. - :ivar backup_management_type: Backup management type for this container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for this container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, } def __init__( - self, - *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - **kwargs + self, *, backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type for this container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for this container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType """ - super(BMSRefreshContainersQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type -class BMSRPQueryObject(msrest.serialization.Model): +class BMSRPQueryObject(_serialization.Model): """Filters to list backup copies. :ivar start_date: Backup copies created after this time. :vartype start_date: ~datetime.datetime :ivar end_date: Backup copies created before this time. :vartype end_date: ~datetime.datetime - :ivar restore_point_query_type: RestorePoint type. Possible values include: "Invalid", "Full", - "Log", "Differential", "FullAndDifferential", "All", "Incremental". + :ivar restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", "Log", + "Differential", "FullAndDifferential", "All", "Incremental", "SnapshotFull", and + "SnapshotCopyOnlyFull". :vartype restore_point_query_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointQueryType :ivar extended_info: In Get Recovery Point, it tells whether extended information about @@ -11645,11 +12864,11 @@ class BMSRPQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, - 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, - 'restore_point_query_type': {'key': 'restorePointQueryType', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'bool'}, - 'move_ready_rp_only': {'key': 'moveReadyRPOnly', 'type': 'bool'}, + "start_date": {"key": "startDate", "type": "iso-8601"}, + "end_date": {"key": "endDate", "type": "iso-8601"}, + "restore_point_query_type": {"key": "restorePointQueryType", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "bool"}, + "move_ready_rp_only": {"key": "moveReadyRPOnly", "type": "bool"}, } def __init__( @@ -11657,7 +12876,7 @@ def __init__( *, start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, - restore_point_query_type: Optional[Union[str, "RestorePointQueryType"]] = None, + restore_point_query_type: Optional[Union[str, "_models.RestorePointQueryType"]] = None, extended_info: Optional[bool] = None, move_ready_rp_only: Optional[bool] = None, **kwargs @@ -11667,8 +12886,9 @@ def __init__( :paramtype start_date: ~datetime.datetime :keyword end_date: Backup copies created before this time. :paramtype end_date: ~datetime.datetime - :keyword restore_point_query_type: RestorePoint type. Possible values include: "Invalid", - "Full", "Log", "Differential", "FullAndDifferential", "All", "Incremental". + :keyword restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", + "Log", "Differential", "FullAndDifferential", "All", "Incremental", "SnapshotFull", and + "SnapshotCopyOnlyFull". :paramtype restore_point_query_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointQueryType :keyword extended_info: In Get Recovery Point, it tells whether extended information about @@ -11677,7 +12897,7 @@ def __init__( :keyword move_ready_rp_only: Whether the RP can be moved to another tier. :paramtype move_ready_rp_only: bool """ - super(BMSRPQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.start_date = start_date self.end_date = end_date self.restore_point_query_type = restore_point_query_type @@ -11685,75 +12905,77 @@ def __init__( self.move_ready_rp_only = move_ready_rp_only -class BMSWorkloadItemQueryObject(msrest.serialization.Model): +class BMSWorkloadItemQueryObject(_serialization.Model): """Filters to list items that can be backed up. - :ivar backup_management_type: Backup management type. Possible values include: "Invalid", + :ivar backup_management_type: Backup management type. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", "AzureWorkload", - "DefaultBackup". + and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_item_type: Workload Item type. Possible values include: "Invalid", - "SQLInstance", "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", - "SAPAseDatabase". + :ivar workload_item_type: Workload Item type. Known values are: "Invalid", "SQLInstance", + "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase", and + "SAPHanaDBInstance". :vartype workload_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemType - :ivar workload_type: Workload type. Possible values include: "Invalid", "VM", "FileFolder", + :ivar workload_type: Workload type. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", - "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase". + "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase", and + "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar protection_status: Backup status query parameter. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :ivar protection_status: Backup status query parameter. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :vartype protection_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_item_type': {'key': 'workloadItemType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_item_type": {"key": "workloadItemType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_item_type: Optional[Union[str, "WorkloadItemType"]] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, - protection_status: Optional[Union[str, "ProtectionStatus"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_item_type: Optional[Union[str, "_models.WorkloadItemType"]] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, + protection_status: Optional[Union[str, "_models.ProtectionStatus"]] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type. Possible values include: "Invalid", + :keyword backup_management_type: Backup management type. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", "AzureWorkload", - "DefaultBackup". + and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_item_type: Workload Item type. Possible values include: "Invalid", - "SQLInstance", "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", - "SAPAseDatabase". + :keyword workload_item_type: Workload Item type. Known values are: "Invalid", "SQLInstance", + "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase", and + "SAPHanaDBInstance". :paramtype workload_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemType - :keyword workload_type: Workload type. Possible values include: "Invalid", "VM", "FileFolder", + :keyword workload_type: Workload type. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", - "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase". + "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", "SAPAseDatabase", and + "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword protection_status: Backup status query parameter. Possible values include: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + :keyword protection_status: Backup status query parameter. Known values are: "Invalid", + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ - super(BMSWorkloadItemQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_item_type = workload_item_type self.workload_type = workload_type self.protection_status = protection_status -class ClientDiscoveryDisplay(msrest.serialization.Model): +class ClientDiscoveryDisplay(_serialization.Model): """Localized display information of an operation. :ivar provider: Name of the provider for display purposes. @@ -11767,10 +12989,10 @@ class ClientDiscoveryDisplay(msrest.serialization.Model): """ _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( @@ -11792,14 +13014,14 @@ def __init__( :keyword description: Description of the operation having details of what operation is about. :paramtype description: str """ - super(ClientDiscoveryDisplay, self).__init__(**kwargs) + super().__init__(**kwargs) self.provider = provider self.resource = resource self.operation = operation self.description = description -class ClientDiscoveryForLogSpecification(msrest.serialization.Model): +class ClientDiscoveryForLogSpecification(_serialization.Model): """Class to represent shoebox log specification in json client discovery. :ivar name: Name for shoebox log specification. @@ -11811,9 +13033,9 @@ class ClientDiscoveryForLogSpecification(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "blob_duration": {"key": "blobDuration", "type": "str"}, } def __init__( @@ -11832,13 +13054,13 @@ def __init__( :keyword blob_duration: blob duration of shoebox log specification. :paramtype blob_duration: str """ - super(ClientDiscoveryForLogSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ClientDiscoveryForProperties(msrest.serialization.Model): +class ClientDiscoveryForProperties(_serialization.Model): """Class to represent shoebox properties in json client discovery. :ivar service_specification: Operation properties. @@ -11847,25 +13069,22 @@ class ClientDiscoveryForProperties(msrest.serialization.Model): """ _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ClientDiscoveryForServiceSpecification'}, + "service_specification": {"key": "serviceSpecification", "type": "ClientDiscoveryForServiceSpecification"}, } def __init__( - self, - *, - service_specification: Optional["ClientDiscoveryForServiceSpecification"] = None, - **kwargs + self, *, service_specification: Optional["_models.ClientDiscoveryForServiceSpecification"] = None, **kwargs ): """ :keyword service_specification: Operation properties. :paramtype service_specification: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryForServiceSpecification """ - super(ClientDiscoveryForProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.service_specification = service_specification -class ClientDiscoveryForServiceSpecification(msrest.serialization.Model): +class ClientDiscoveryForServiceSpecification(_serialization.Model): """Class to represent shoebox service specification in json client discovery. :ivar log_specifications: List of log specifications of this operation. @@ -11874,25 +13093,22 @@ class ClientDiscoveryForServiceSpecification(msrest.serialization.Model): """ _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[ClientDiscoveryForLogSpecification]'}, + "log_specifications": {"key": "logSpecifications", "type": "[ClientDiscoveryForLogSpecification]"}, } def __init__( - self, - *, - log_specifications: Optional[List["ClientDiscoveryForLogSpecification"]] = None, - **kwargs + self, *, log_specifications: Optional[List["_models.ClientDiscoveryForLogSpecification"]] = None, **kwargs ): """ :keyword log_specifications: List of log specifications of this operation. :paramtype log_specifications: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryForLogSpecification] """ - super(ClientDiscoveryForServiceSpecification, self).__init__(**kwargs) + super().__init__(**kwargs) self.log_specifications = log_specifications -class ClientDiscoveryResponse(msrest.serialization.Model): +class ClientDiscoveryResponse(_serialization.Model): """Operations List response which contains list of available APIs. :ivar value: List of available operations. @@ -11903,14 +13119,14 @@ class ClientDiscoveryResponse(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[ClientDiscoveryValueForSingleApi]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "value": {"key": "value", "type": "[ClientDiscoveryValueForSingleApi]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["ClientDiscoveryValueForSingleApi"]] = None, + value: Optional[List["_models.ClientDiscoveryValueForSingleApi"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -11921,12 +13137,12 @@ def __init__( :keyword next_link: Link to the next chunk of Response. :paramtype next_link: str """ - super(ClientDiscoveryResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.next_link = next_link -class ClientDiscoveryValueForSingleApi(msrest.serialization.Model): +class ClientDiscoveryValueForSingleApi(_serialization.Model): """Available operation details. :ivar name: Name of the Operation. @@ -11942,19 +13158,19 @@ class ClientDiscoveryValueForSingleApi(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ClientDiscoveryDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ClientDiscoveryForProperties'}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "ClientDiscoveryDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "ClientDiscoveryForProperties"}, } def __init__( self, *, name: Optional[str] = None, - display: Optional["ClientDiscoveryDisplay"] = None, + display: Optional["_models.ClientDiscoveryDisplay"] = None, origin: Optional[str] = None, - properties: Optional["ClientDiscoveryForProperties"] = None, + properties: Optional["_models.ClientDiscoveryForProperties"] = None, **kwargs ): """ @@ -11970,14 +13186,14 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryForProperties """ - super(ClientDiscoveryValueForSingleApi, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.display = display self.origin = origin self.properties = properties -class ClientScriptForConnect(msrest.serialization.Model): +class ClientScriptForConnect(_serialization.Model): """Client script details for file / folder restore. :ivar script_content: File content of the client script for file / folder restore. @@ -11998,11 +13214,11 @@ class ClientScriptForConnect(msrest.serialization.Model): """ _attribute_map = { - 'script_content': {'key': 'scriptContent', 'type': 'str'}, - 'script_extension': {'key': 'scriptExtension', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'script_name_suffix': {'key': 'scriptNameSuffix', 'type': 'str'}, + "script_content": {"key": "scriptContent", "type": "str"}, + "script_extension": {"key": "scriptExtension", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "script_name_suffix": {"key": "scriptNameSuffix", "type": "str"}, } def __init__( @@ -12032,7 +13248,7 @@ def __init__( If its null or empty then , ignore it. :paramtype script_name_suffix: str """ - super(ClientScriptForConnect, self).__init__(**kwargs) + super().__init__(**kwargs) self.script_content = script_content self.script_extension = script_extension self.os_type = os_type @@ -12040,7 +13256,7 @@ def __init__( self.script_name_suffix = script_name_suffix -class CloudErrorBody(msrest.serialization.Model): +class CloudErrorBody(_serialization.Model): """An error response from the Container Instance service. Variables are only populated by the server, and will be ignored when sending a request. @@ -12062,28 +13278,24 @@ class CloudErrorBody(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(CloudErrorBody, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -12091,7 +13303,7 @@ def __init__( self.additional_info = None -class ContainerIdentityInfo(msrest.serialization.Model): +class ContainerIdentityInfo(_serialization.Model): """Container identity information. :ivar unique_name: Unique name of the container. @@ -12105,10 +13317,10 @@ class ContainerIdentityInfo(msrest.serialization.Model): """ _attribute_map = { - 'unique_name': {'key': 'uniqueName', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, + "unique_name": {"key": "uniqueName", "type": "str"}, + "aad_tenant_id": {"key": "aadTenantId", "type": "str"}, + "service_principal_client_id": {"key": "servicePrincipalClientId", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, } def __init__( @@ -12130,14 +13342,14 @@ def __init__( :keyword audience: Protection container identity - Audience. :paramtype audience: str """ - super(ContainerIdentityInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.unique_name = unique_name self.aad_tenant_id = aad_tenant_id self.service_principal_client_id = service_principal_client_id self.audience = audience -class DailyRetentionFormat(msrest.serialization.Model): +class DailyRetentionFormat(_serialization.Model): """Daily retention format. :ivar days_of_the_month: List of days of the month. @@ -12145,24 +13357,19 @@ class DailyRetentionFormat(msrest.serialization.Model): """ _attribute_map = { - 'days_of_the_month': {'key': 'daysOfTheMonth', 'type': '[Day]'}, + "days_of_the_month": {"key": "daysOfTheMonth", "type": "[Day]"}, } - def __init__( - self, - *, - days_of_the_month: Optional[List["Day"]] = None, - **kwargs - ): + def __init__(self, *, days_of_the_month: Optional[List["_models.Day"]] = None, **kwargs): """ :keyword days_of_the_month: List of days of the month. :paramtype days_of_the_month: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.Day] """ - super(DailyRetentionFormat, self).__init__(**kwargs) + super().__init__(**kwargs) self.days_of_the_month = days_of_the_month -class DailyRetentionSchedule(msrest.serialization.Model): +class DailyRetentionSchedule(_serialization.Model): """Daily retention schedule. :ivar retention_times: Retention times of retention policy. @@ -12173,15 +13380,15 @@ class DailyRetentionSchedule(msrest.serialization.Model): """ _attribute_map = { - 'retention_times': {'key': 'retentionTimes', 'type': '[iso-8601]'}, - 'retention_duration': {'key': 'retentionDuration', 'type': 'RetentionDuration'}, + "retention_times": {"key": "retentionTimes", "type": "[iso-8601]"}, + "retention_duration": {"key": "retentionDuration", "type": "RetentionDuration"}, } def __init__( self, *, retention_times: Optional[List[datetime.datetime]] = None, - retention_duration: Optional["RetentionDuration"] = None, + retention_duration: Optional["_models.RetentionDuration"] = None, **kwargs ): """ @@ -12191,12 +13398,12 @@ def __init__( :paramtype retention_duration: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDuration """ - super(DailyRetentionSchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.retention_times = retention_times self.retention_duration = retention_duration -class DailySchedule(msrest.serialization.Model): +class DailySchedule(_serialization.Model): """DailySchedule. :ivar schedule_run_times: List of times of day this schedule has to be run. @@ -12204,24 +13411,19 @@ class DailySchedule(msrest.serialization.Model): """ _attribute_map = { - 'schedule_run_times': {'key': 'scheduleRunTimes', 'type': '[iso-8601]'}, + "schedule_run_times": {"key": "scheduleRunTimes", "type": "[iso-8601]"}, } - def __init__( - self, - *, - schedule_run_times: Optional[List[datetime.datetime]] = None, - **kwargs - ): + def __init__(self, *, schedule_run_times: Optional[List[datetime.datetime]] = None, **kwargs): """ :keyword schedule_run_times: List of times of day this schedule has to be run. :paramtype schedule_run_times: list[~datetime.datetime] """ - super(DailySchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.schedule_run_times = schedule_run_times -class Day(msrest.serialization.Model): +class Day(_serialization.Model): """Day of the week. :ivar date: Date of the month. @@ -12231,29 +13433,23 @@ class Day(msrest.serialization.Model): """ _attribute_map = { - 'date': {'key': 'date', 'type': 'int'}, - 'is_last': {'key': 'isLast', 'type': 'bool'}, + "date": {"key": "date", "type": "int"}, + "is_last": {"key": "isLast", "type": "bool"}, } - def __init__( - self, - *, - date: Optional[int] = None, - is_last: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, date: Optional[int] = None, is_last: Optional[bool] = None, **kwargs): """ :keyword date: Date of the month. :paramtype date: int :keyword is_last: Whether Date is last date of month. :paramtype is_last: bool """ - super(Day, self).__init__(**kwargs) + super().__init__(**kwargs) self.date = date self.is_last = is_last -class DiskExclusionProperties(msrest.serialization.Model): +class DiskExclusionProperties(_serialization.Model): """DiskExclusionProperties. :ivar disk_lun_list: List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. @@ -12264,16 +13460,12 @@ class DiskExclusionProperties(msrest.serialization.Model): """ _attribute_map = { - 'disk_lun_list': {'key': 'diskLunList', 'type': '[int]'}, - 'is_inclusion_list': {'key': 'isInclusionList', 'type': 'bool'}, + "disk_lun_list": {"key": "diskLunList", "type": "[int]"}, + "is_inclusion_list": {"key": "isInclusionList", "type": "bool"}, } def __init__( - self, - *, - disk_lun_list: Optional[List[int]] = None, - is_inclusion_list: Optional[bool] = None, - **kwargs + self, *, disk_lun_list: Optional[List[int]] = None, is_inclusion_list: Optional[bool] = None, **kwargs ): """ :keyword disk_lun_list: List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. @@ -12282,12 +13474,12 @@ def __init__( from backup. :paramtype is_inclusion_list: bool """ - super(DiskExclusionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_lun_list = disk_lun_list self.is_inclusion_list = is_inclusion_list -class DiskInformation(msrest.serialization.Model): +class DiskInformation(_serialization.Model): """Disk information. :ivar lun: @@ -12297,29 +13489,23 @@ class DiskInformation(msrest.serialization.Model): """ _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, + "lun": {"key": "lun", "type": "int"}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - lun: Optional[int] = None, - name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, lun: Optional[int] = None, name: Optional[str] = None, **kwargs): """ :keyword lun: :paramtype lun: int :keyword name: :paramtype name: str """ - super(DiskInformation, self).__init__(**kwargs) + super().__init__(**kwargs) self.lun = lun self.name = name -class DistributedNodesInfo(msrest.serialization.Model): +class DistributedNodesInfo(_serialization.Model): """This is used to represent the various nodes of the distributed container. :ivar node_name: Name of the node under a distributed container. @@ -12332,9 +13518,9 @@ class DistributedNodesInfo(msrest.serialization.Model): """ _attribute_map = { - 'node_name': {'key': 'nodeName', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'error_detail': {'key': 'errorDetail', 'type': 'ErrorDetail'}, + "node_name": {"key": "nodeName", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "error_detail": {"key": "errorDetail", "type": "ErrorDetail"}, } def __init__( @@ -12342,7 +13528,7 @@ def __init__( *, node_name: Optional[str] = None, status: Optional[str] = None, - error_detail: Optional["ErrorDetail"] = None, + error_detail: Optional["_models.ErrorDetail"] = None, **kwargs ): """ @@ -12354,22 +13540,22 @@ def __init__( :keyword error_detail: Error Details if the Status is non-success. :paramtype error_detail: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ErrorDetail """ - super(DistributedNodesInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.node_name = node_name self.status = status self.error_detail = error_detail -class DpmBackupEngine(BackupEngineBase): +class DpmBackupEngine(BackupEngineBase): # pylint: disable=too-many-instance-attributes """Data Protection Manager (DPM) specific backup engine. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the backup engine. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the backup engine. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Registration status of the backup engine with the Recovery Services @@ -12380,8 +13566,8 @@ class DpmBackupEngine(BackupEngineBase): :vartype backup_engine_state: str :ivar health_status: Backup status of the backup engine. :vartype health_status: str - :ivar backup_engine_type: Required. Type of the backup engine.Constant filled by server. - Possible values include: "Invalid", "DpmBackupEngine", "AzureBackupServerEngine". + :ivar backup_engine_type: Type of the backup engine. Required. Known values are: "Invalid", + "DpmBackupEngine", and "AzureBackupServerEngine". :vartype backup_engine_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineType :ivar can_re_register: Flag indicating if the backup engine be registered, once already @@ -12403,30 +13589,30 @@ class DpmBackupEngine(BackupEngineBase): """ _validation = { - 'backup_engine_type': {'required': True}, + "backup_engine_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'backup_engine_state': {'key': 'backupEngineState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'backup_engine_type': {'key': 'backupEngineType', 'type': 'str'}, - 'can_re_register': {'key': 'canReRegister', 'type': 'bool'}, - 'backup_engine_id': {'key': 'backupEngineId', 'type': 'str'}, - 'dpm_version': {'key': 'dpmVersion', 'type': 'str'}, - 'azure_backup_agent_version': {'key': 'azureBackupAgentVersion', 'type': 'str'}, - 'is_azure_backup_agent_upgrade_available': {'key': 'isAzureBackupAgentUpgradeAvailable', 'type': 'bool'}, - 'is_dpm_upgrade_available': {'key': 'isDpmUpgradeAvailable', 'type': 'bool'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'BackupEngineExtendedInfo'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "backup_engine_state": {"key": "backupEngineState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "backup_engine_type": {"key": "backupEngineType", "type": "str"}, + "can_re_register": {"key": "canReRegister", "type": "bool"}, + "backup_engine_id": {"key": "backupEngineId", "type": "str"}, + "dpm_version": {"key": "dpmVersion", "type": "str"}, + "azure_backup_agent_version": {"key": "azureBackupAgentVersion", "type": "str"}, + "is_azure_backup_agent_upgrade_available": {"key": "isAzureBackupAgentUpgradeAvailable", "type": "bool"}, + "is_dpm_upgrade_available": {"key": "isDpmUpgradeAvailable", "type": "bool"}, + "extended_info": {"key": "extendedInfo", "type": "BackupEngineExtendedInfo"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, backup_engine_state: Optional[str] = None, health_status: Optional[str] = None, @@ -12436,15 +13622,15 @@ def __init__( azure_backup_agent_version: Optional[str] = None, is_azure_backup_agent_upgrade_available: Optional[bool] = None, is_dpm_upgrade_available: Optional[bool] = None, - extended_info: Optional["BackupEngineExtendedInfo"] = None, + extended_info: Optional["_models.BackupEngineExtendedInfo"] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the backup engine. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the backup engine. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backup engine. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Registration status of the backup engine with the Recovery @@ -12472,11 +13658,25 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineExtendedInfo """ - super(DpmBackupEngine, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, backup_engine_state=backup_engine_state, health_status=health_status, can_re_register=can_re_register, backup_engine_id=backup_engine_id, dpm_version=dpm_version, azure_backup_agent_version=azure_backup_agent_version, is_azure_backup_agent_upgrade_available=is_azure_backup_agent_upgrade_available, is_dpm_upgrade_available=is_dpm_upgrade_available, extended_info=extended_info, **kwargs) - self.backup_engine_type = 'DpmBackupEngine' # type: str - - -class DPMContainerExtendedInfo(msrest.serialization.Model): + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + backup_engine_state=backup_engine_state, + health_status=health_status, + can_re_register=can_re_register, + backup_engine_id=backup_engine_id, + dpm_version=dpm_version, + azure_backup_agent_version=azure_backup_agent_version, + is_azure_backup_agent_upgrade_available=is_azure_backup_agent_upgrade_available, + is_dpm_upgrade_available=is_dpm_upgrade_available, + extended_info=extended_info, + **kwargs + ) + self.backup_engine_type = "DpmBackupEngine" # type: str + + +class DPMContainerExtendedInfo(_serialization.Model): """Additional information of the DPMContainer. :ivar last_refreshed_at: Last refresh time of the DPMContainer. @@ -12484,24 +13684,19 @@ class DPMContainerExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'last_refreshed_at': {'key': 'lastRefreshedAt', 'type': 'iso-8601'}, + "last_refreshed_at": {"key": "lastRefreshedAt", "type": "iso-8601"}, } - def __init__( - self, - *, - last_refreshed_at: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, last_refreshed_at: Optional[datetime.datetime] = None, **kwargs): """ :keyword last_refreshed_at: Last refresh time of the DPMContainer. :paramtype last_refreshed_at: ~datetime.datetime """ - super(DPMContainerExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.last_refreshed_at = last_refreshed_at -class DpmErrorInfo(msrest.serialization.Model): +class DpmErrorInfo(_serialization.Model): """DPM workload-specific error information. :ivar error_string: Localized error string. @@ -12511,38 +13706,32 @@ class DpmErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - *, - error_string: Optional[str] = None, - recommendations: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, error_string: Optional[str] = None, recommendations: Optional[List[str]] = None, **kwargs): """ :keyword error_string: Localized error string. :paramtype error_string: str :keyword recommendations: List of localized recommendations for above error code. :paramtype recommendations: list[str] """ - super(DpmErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_string = error_string self.recommendations = recommendations -class DpmJob(Job): +class DpmJob(Job): # pylint: disable=too-many-instance-attributes """DPM workload-specific job object. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -12555,8 +13744,8 @@ class DpmJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed for job. :vartype duration: ~datetime.timedelta @@ -12580,33 +13769,33 @@ class DpmJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'dpm_server_name': {'key': 'dpmServerName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[DpmErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'DpmJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "dpm_server_name": {"key": "dpmServerName", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[DpmErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "DpmJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, @@ -12617,18 +13806,18 @@ def __init__( container_name: Optional[str] = None, container_type: Optional[str] = None, workload_type: Optional[str] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["DpmErrorInfo"]] = None, - extended_info: Optional["DpmJobExtendedInfo"] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.DpmErrorInfo"]] = None, + extended_info: Optional["_models.DpmJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -12661,8 +13850,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.DpmJobExtendedInfo """ - super(DpmJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'DpmJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "DpmJob" # type: str self.duration = duration self.dpm_server_name = dpm_server_name self.container_name = container_name @@ -12673,7 +13871,7 @@ def __init__( self.extended_info = extended_info -class DpmJobExtendedInfo(msrest.serialization.Model): +class DpmJobExtendedInfo(_serialization.Model): """Additional information on the DPM workload-specific job. :ivar tasks_list: List of tasks associated with this job. @@ -12686,15 +13884,15 @@ class DpmJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[DpmJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[DpmJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["DpmJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.DpmJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -12708,13 +13906,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(DpmJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class DpmJobTaskDetails(msrest.serialization.Model): +class DpmJobTaskDetails(_serialization.Model): """DPM workload-specific job task details. :ivar task_id: The task display name. @@ -12730,11 +13928,11 @@ class DpmJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "duration": {"key": "duration", "type": "duration"}, + "status": {"key": "status", "type": "str"}, } def __init__( @@ -12759,7 +13957,7 @@ def __init__( :keyword status: The status. :paramtype status: str """ - super(DpmJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.start_time = start_time self.end_time = end_time @@ -12767,22 +13965,24 @@ def __init__( self.status = status -class DPMProtectedItem(ProtectedItem): +class DPMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Additional information on Backup engine specific backup item. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -12797,7 +13997,7 @@ class DPMProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -12823,9 +14023,8 @@ class DPMProtectedItem(ProtectedItem): :vartype friendly_name: str :ivar backup_engine_name: Backup Management server protecting this backup item. :vartype backup_engine_name: str - :ivar protection_state: Protection state of the backup engine. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :ivar protection_state: Protection state of the backup engine. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemState :ivar extended_info: Extended info of the backup item. @@ -12834,44 +14033,44 @@ class DPMProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_engine_name': {'key': 'backupEngineName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'DPMProtectedItemExtendedInfo'}, + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_engine_name": {"key": "backupEngineName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "DPMProtectedItemExtendedInfo"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -12882,22 +14081,11 @@ def __init__( policy_name: Optional[str] = None, friendly_name: Optional[str] = None, backup_engine_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectedItemState"]] = None, - extended_info: Optional["DPMProtectedItemExtendedInfo"] = None, + protection_state: Optional[Union[str, "_models.ProtectedItemState"]] = None, + extended_info: Optional["_models.DPMProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -12910,7 +14098,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -12937,24 +14125,39 @@ def __init__( :paramtype friendly_name: str :keyword backup_engine_name: Backup Management server protecting this backup item. :paramtype backup_engine_name: str - :keyword protection_state: Protection state of the backup engine. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Protection state of the backup engine. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemState :keyword extended_info: Extended info of the backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.DPMProtectedItemExtendedInfo """ - super(DPMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'DPMProtectedItem' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "DPMProtectedItem" # type: str self.friendly_name = friendly_name self.backup_engine_name = backup_engine_name self.protection_state = protection_state self.extended_info = extended_info -class DPMProtectedItemExtendedInfo(msrest.serialization.Model): +class DPMProtectedItemExtendedInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes """Additional information of DPM Protected item. :ivar protectable_object_load_path: Attribute to provide information on various DBs. @@ -12988,20 +14191,20 @@ class DPMProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'protectable_object_load_path': {'key': 'protectableObjectLoadPath', 'type': '{str}'}, - 'protected': {'key': 'protected', 'type': 'bool'}, - 'is_present_on_cloud': {'key': 'isPresentOnCloud', 'type': 'bool'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_refreshed_at': {'key': 'lastRefreshedAt', 'type': 'iso-8601'}, - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'on_premise_oldest_recovery_point': {'key': 'onPremiseOldestRecoveryPoint', 'type': 'iso-8601'}, - 'on_premise_latest_recovery_point': {'key': 'onPremiseLatestRecoveryPoint', 'type': 'iso-8601'}, - 'on_premise_recovery_point_count': {'key': 'onPremiseRecoveryPointCount', 'type': 'int'}, - 'is_collocated': {'key': 'isCollocated', 'type': 'bool'}, - 'protection_group_name': {'key': 'protectionGroupName', 'type': 'str'}, - 'disk_storage_used_in_bytes': {'key': 'diskStorageUsedInBytes', 'type': 'str'}, - 'total_disk_storage_size_in_bytes': {'key': 'totalDiskStorageSizeInBytes', 'type': 'str'}, + "protectable_object_load_path": {"key": "protectableObjectLoadPath", "type": "{str}"}, + "protected": {"key": "protected", "type": "bool"}, + "is_present_on_cloud": {"key": "isPresentOnCloud", "type": "bool"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_refreshed_at": {"key": "lastRefreshedAt", "type": "iso-8601"}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "on_premise_oldest_recovery_point": {"key": "onPremiseOldestRecoveryPoint", "type": "iso-8601"}, + "on_premise_latest_recovery_point": {"key": "onPremiseLatestRecoveryPoint", "type": "iso-8601"}, + "on_premise_recovery_point_count": {"key": "onPremiseRecoveryPointCount", "type": "int"}, + "is_collocated": {"key": "isCollocated", "type": "bool"}, + "protection_group_name": {"key": "protectionGroupName", "type": "str"}, + "disk_storage_used_in_bytes": {"key": "diskStorageUsedInBytes", "type": "str"}, + "total_disk_storage_size_in_bytes": {"key": "totalDiskStorageSizeInBytes", "type": "str"}, } def __init__( @@ -13053,7 +14256,7 @@ def __init__( :keyword total_disk_storage_size_in_bytes: total Disk storage in bytes. :paramtype total_disk_storage_size_in_bytes: str """ - super(DPMProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.protectable_object_load_path = protectable_object_load_path self.protected = protected self.is_present_on_cloud = is_present_on_cloud @@ -13070,7 +14273,7 @@ def __init__( self.total_disk_storage_size_in_bytes = total_disk_storage_size_in_bytes -class EncryptionDetails(msrest.serialization.Model): +class EncryptionDetails(_serialization.Model): """Details needed if the VM was encrypted at the time of backup. :ivar encryption_enabled: Identifies whether this backup copy represents an encrypted VM at the @@ -13087,11 +14290,11 @@ class EncryptionDetails(msrest.serialization.Model): """ _attribute_map = { - 'encryption_enabled': {'key': 'encryptionEnabled', 'type': 'bool'}, - 'kek_url': {'key': 'kekUrl', 'type': 'str'}, - 'secret_key_url': {'key': 'secretKeyUrl', 'type': 'str'}, - 'kek_vault_id': {'key': 'kekVaultId', 'type': 'str'}, - 'secret_key_vault_id': {'key': 'secretKeyVaultId', 'type': 'str'}, + "encryption_enabled": {"key": "encryptionEnabled", "type": "bool"}, + "kek_url": {"key": "kekUrl", "type": "str"}, + "secret_key_url": {"key": "secretKeyUrl", "type": "str"}, + "kek_vault_id": {"key": "kekVaultId", "type": "str"}, + "secret_key_vault_id": {"key": "secretKeyVaultId", "type": "str"}, } def __init__( @@ -13117,7 +14320,7 @@ def __init__( :keyword secret_key_vault_id: ID of Key Vault where Secret is stored. :paramtype secret_key_vault_id: str """ - super(EncryptionDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.encryption_enabled = encryption_enabled self.kek_url = kek_url self.secret_key_url = secret_key_url @@ -13125,7 +14328,7 @@ def __init__( self.secret_key_vault_id = secret_key_vault_id -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -13133,31 +14336,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorDetail(msrest.serialization.Model): +class ErrorDetail(_serialization.Model): """Error Detail class which encapsulates Code, Message and Recommendations. Variables are only populated by the server, and will be ignored when sending a request. @@ -13171,61 +14370,56 @@ class ErrorDetail(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'recommendations': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorDetail, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.recommendations = None -class OperationResultInfoBase(msrest.serialization.Model): +class OperationResultInfoBase(_serialization.Model): """Base class for operation result info. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExportJobsOperationResultInfo, OperationResultInfo. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ExportJobsOperationResultInfo, OperationResultInfo All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'ExportJobsOperationResultInfo': 'ExportJobsOperationResultInfo', 'OperationResultInfo': 'OperationResultInfo'} + "object_type": { + "ExportJobsOperationResultInfo": "ExportJobsOperationResultInfo", + "OperationResultInfo": "OperationResultInfo", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationResultInfoBase, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -13234,8 +14428,8 @@ class ExportJobsOperationResultInfo(OperationResultInfoBase): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar blob_url: URL of the blob into which the serialized string of list of jobs is exported. :vartype blob_url: str @@ -13248,15 +14442,15 @@ class ExportJobsOperationResultInfo(OperationResultInfoBase): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - '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'}, + "object_type": {"key": "objectType", "type": "str"}, + "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__( @@ -13279,15 +14473,15 @@ def __init__( :keyword excel_file_blob_sas_key: SAS key to access the blob. It expires in 15 mins. :paramtype excel_file_blob_sas_key: str """ - super(ExportJobsOperationResultInfo, self).__init__(**kwargs) - self.object_type = 'ExportJobsOperationResultInfo' # type: str + super().__init__(**kwargs) + self.object_type = "ExportJobsOperationResultInfo" # type: str self.blob_url = blob_url self.blob_sas_key = blob_sas_key self.excel_file_blob_url = excel_file_blob_url self.excel_file_blob_sas_key = excel_file_blob_sas_key -class ExtendedProperties(msrest.serialization.Model): +class ExtendedProperties(_serialization.Model): """Extended Properties for Azure IaasVM Backup. :ivar disk_exclusion_properties: Extended Properties for Disk Exclusion. @@ -13298,14 +14492,14 @@ class ExtendedProperties(msrest.serialization.Model): """ _attribute_map = { - 'disk_exclusion_properties': {'key': 'diskExclusionProperties', 'type': 'DiskExclusionProperties'}, - 'linux_vm_application_name': {'key': 'linuxVmApplicationName', 'type': 'str'}, + "disk_exclusion_properties": {"key": "diskExclusionProperties", "type": "DiskExclusionProperties"}, + "linux_vm_application_name": {"key": "linuxVmApplicationName", "type": "str"}, } def __init__( self, *, - disk_exclusion_properties: Optional["DiskExclusionProperties"] = None, + disk_exclusion_properties: Optional["_models.DiskExclusionProperties"] = None, linux_vm_application_name: Optional[str] = None, **kwargs ): @@ -13316,7 +14510,7 @@ def __init__( :keyword linux_vm_application_name: Linux VM name. :paramtype linux_vm_application_name: str """ - super(ExtendedProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_exclusion_properties = disk_exclusion_properties self.linux_vm_application_name = linux_vm_application_name @@ -13328,9 +14522,9 @@ class GenericContainer(ProtectionContainer): :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -13338,20 +14532,20 @@ class GenericContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar fabric_name: Name of the container's fabric. @@ -13362,38 +14556,38 @@ class GenericContainer(ProtectionContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'extended_information': {'key': 'extendedInformation', 'type': 'GenericContainerExtendedInfo'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "extended_information": {"key": "extendedInformation", "type": "GenericContainerExtendedInfo"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, fabric_name: Optional[str] = None, - extended_information: Optional["GenericContainerExtendedInfo"] = None, + extended_information: Optional["_models.GenericContainerExtendedInfo"] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -13410,13 +14604,20 @@ def __init__( :paramtype extended_information: ~azure.mgmt.recoveryservicesbackup.activestamp.models.GenericContainerExtendedInfo """ - super(GenericContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'GenericContainer' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "GenericContainer" # type: str self.fabric_name = fabric_name self.extended_information = extended_information -class GenericContainerExtendedInfo(msrest.serialization.Model): +class GenericContainerExtendedInfo(_serialization.Model): """Container extended information. :ivar raw_cert_data: Public key of container cert. @@ -13429,16 +14630,16 @@ class GenericContainerExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'raw_cert_data': {'key': 'rawCertData', 'type': 'str'}, - 'container_identity_info': {'key': 'containerIdentityInfo', 'type': 'ContainerIdentityInfo'}, - 'service_endpoints': {'key': 'serviceEndpoints', 'type': '{str}'}, + "raw_cert_data": {"key": "rawCertData", "type": "str"}, + "container_identity_info": {"key": "containerIdentityInfo", "type": "ContainerIdentityInfo"}, + "service_endpoints": {"key": "serviceEndpoints", "type": "{str}"}, } def __init__( self, *, raw_cert_data: Optional[str] = None, - container_identity_info: Optional["ContainerIdentityInfo"] = None, + container_identity_info: Optional["_models.ContainerIdentityInfo"] = None, service_endpoints: Optional[Dict[str, str]] = None, **kwargs ): @@ -13451,28 +14652,30 @@ def __init__( :keyword service_endpoints: Azure Backup Service Endpoints for the container. :paramtype service_endpoints: dict[str, str] """ - super(GenericContainerExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.raw_cert_data = raw_cert_data self.container_identity_info = container_identity_info self.service_endpoints = service_endpoints -class GenericProtectedItem(ProtectedItem): +class GenericProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Base class for backup items. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -13487,7 +14690,7 @@ class GenericProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -13514,12 +14717,12 @@ class GenericProtectedItem(ProtectedItem): :ivar policy_state: Indicates consistency of policy object and policy applied to this backup item. :vartype policy_state: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :ivar protected_item_id: Data Plane Service ID of the protected item. - :vartype protected_item_id: long + :vartype protected_item_id: int :ivar source_associations: Loosely coupled (type, value) associations (example - parent of a protected item). :vartype source_associations: dict[str, str] @@ -13528,46 +14731,46 @@ class GenericProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'protected_item_id': {'key': 'protectedItemId', 'type': 'long'}, - 'source_associations': {'key': 'sourceAssociations', 'type': '{str}'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "policy_state": {"key": "policyState", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "protected_item_id": {"key": "protectedItemId", "type": "int"}, + "source_associations": {"key": "sourceAssociations", "type": "{str}"}, + "fabric_name": {"key": "fabricName", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -13578,24 +14781,13 @@ def __init__( policy_name: Optional[str] = None, friendly_name: Optional[str] = None, policy_state: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, protected_item_id: Optional[int] = None, source_associations: Optional[Dict[str, str]] = None, fabric_name: Optional[str] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -13608,7 +14800,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -13636,21 +14828,36 @@ def __init__( :keyword policy_state: Indicates consistency of policy object and policy applied to this backup item. :paramtype policy_state: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword protected_item_id: Data Plane Service ID of the protected item. - :paramtype protected_item_id: long + :paramtype protected_item_id: int :keyword source_associations: Loosely coupled (type, value) associations (example - parent of a protected item). :paramtype source_associations: dict[str, str] :keyword fabric_name: Name of this backup item's fabric. :paramtype fabric_name: str """ - super(GenericProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'GenericProtectedItem' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "GenericProtectedItem" # type: str self.friendly_name = friendly_name self.policy_state = policy_state self.protection_state = protection_state @@ -13666,8 +14873,8 @@ class GenericProtectionPolicy(ProtectionPolicy): :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] @@ -13683,16 +14890,16 @@ class GenericProtectionPolicy(ProtectionPolicy): """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'sub_protection_policy': {'key': 'subProtectionPolicy', 'type': '[SubProtectionPolicy]'}, - 'time_zone': {'key': 'timeZone', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "sub_protection_policy": {"key": "subProtectionPolicy", "type": "[SubProtectionPolicy]"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, } def __init__( @@ -13700,7 +14907,7 @@ def __init__( *, protected_items_count: Optional[int] = None, resource_guard_operation_requests: Optional[List[str]] = None, - sub_protection_policy: Optional[List["SubProtectionPolicy"]] = None, + sub_protection_policy: Optional[List["_models.SubProtectionPolicy"]] = None, time_zone: Optional[str] = None, fabric_name: Optional[str] = None, **kwargs @@ -13720,8 +14927,12 @@ def __init__( :keyword fabric_name: Name of this policy's fabric. :paramtype fabric_name: str """ - super(GenericProtectionPolicy, self).__init__(protected_items_count=protected_items_count, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.backup_management_type = 'GenericProtectionPolicy' # type: str + super().__init__( + protected_items_count=protected_items_count, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.backup_management_type = "GenericProtectionPolicy" # type: str self.sub_protection_policy = sub_protection_policy self.time_zone = time_zone self.fabric_name = fabric_name @@ -13732,8 +14943,8 @@ class GenericRecoveryPoint(RecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar friendly_name: Friendly name of the backup copy. :vartype friendly_name: str @@ -13746,15 +14957,15 @@ class GenericRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_additional_info': {'key': 'recoveryPointAdditionalInfo', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "recovery_point_additional_info": {"key": "recoveryPointAdditionalInfo", "type": "str"}, } def __init__( @@ -13777,15 +14988,15 @@ def __init__( copy. :paramtype recovery_point_additional_info: str """ - super(GenericRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'GenericRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "GenericRecoveryPoint" # type: str self.friendly_name = friendly_name self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time self.recovery_point_additional_info = recovery_point_additional_info -class GetProtectedItemQueryObject(msrest.serialization.Model): +class GetProtectedItemQueryObject(_serialization.Model): """Filters to list backup items. :ivar expand: Specifies if the additional information should be provided for this item. @@ -13793,24 +15004,19 @@ class GetProtectedItemQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'expand': {'key': 'expand', 'type': 'str'}, + "expand": {"key": "expand", "type": "str"}, } - def __init__( - self, - *, - expand: Optional[str] = None, - **kwargs - ): + def __init__(self, *, expand: Optional[str] = None, **kwargs): """ :keyword expand: Specifies if the additional information should be provided for this item. :paramtype expand: str """ - super(GetProtectedItemQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.expand = expand -class HourlySchedule(msrest.serialization.Model): +class HourlySchedule(_serialization.Model): """HourlySchedule. :ivar interval: Interval at which backup needs to be triggered. For hourly the value @@ -13823,9 +15029,9 @@ class HourlySchedule(msrest.serialization.Model): """ _attribute_map = { - 'interval': {'key': 'interval', 'type': 'int'}, - 'schedule_window_start_time': {'key': 'scheduleWindowStartTime', 'type': 'iso-8601'}, - 'schedule_window_duration': {'key': 'scheduleWindowDuration', 'type': 'int'}, + "interval": {"key": "interval", "type": "int"}, + "schedule_window_start_time": {"key": "scheduleWindowStartTime", "type": "iso-8601"}, + "schedule_window_duration": {"key": "scheduleWindowDuration", "type": "int"}, } def __init__( @@ -13845,7 +15051,7 @@ def __init__( :keyword schedule_window_duration: To specify duration of the backup window. :paramtype schedule_window_duration: int """ - super(HourlySchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.interval = interval self.schedule_window_start_time = schedule_window_start_time self.schedule_window_duration = schedule_window_duration @@ -13856,8 +15062,8 @@ class IaasVMBackupRequest(BackupRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_expiry_time_in_utc: Backup copy will expire after the time specified (UTC). @@ -13865,27 +15071,22 @@ class IaasVMBackupRequest(BackupRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_expiry_time_in_utc': {'key': 'recoveryPointExpiryTimeInUTC', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_expiry_time_in_utc": {"key": "recoveryPointExpiryTimeInUTC", "type": "iso-8601"}, } - def __init__( - self, - *, - recovery_point_expiry_time_in_utc: Optional[datetime.datetime] = None, - **kwargs - ): + def __init__(self, *, recovery_point_expiry_time_in_utc: Optional[datetime.datetime] = None, **kwargs): """ :keyword recovery_point_expiry_time_in_utc: Backup copy will expire after the time specified (UTC). :paramtype recovery_point_expiry_time_in_utc: ~datetime.datetime """ - super(IaasVMBackupRequest, self).__init__(**kwargs) - self.object_type = 'IaasVMBackupRequest' # type: str + super().__init__(**kwargs) + self.object_type = "IaasVMBackupRequest" # type: str self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc @@ -13894,8 +15095,8 @@ class IaasVMILRRegistrationRequest(ILRRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_id: ID of the IaaS VM backup copy from where the files/folders have to be restored. @@ -13911,15 +15112,15 @@ class IaasVMILRRegistrationRequest(ILRRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'initiator_name': {'key': 'initiatorName', 'type': 'str'}, - 'renew_existing_registration': {'key': 'renewExistingRegistration', 'type': 'bool'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "initiator_name": {"key": "initiatorName", "type": "str"}, + "renew_existing_registration": {"key": "renewExistingRegistration", "type": "bool"}, } def __init__( @@ -13944,21 +15145,21 @@ def __init__( server. :paramtype renew_existing_registration: bool """ - super(IaasVMILRRegistrationRequest, self).__init__(**kwargs) - self.object_type = 'IaasVMILRRegistrationRequest' # type: str + super().__init__(**kwargs) + self.object_type = "IaasVMILRRegistrationRequest" # type: str self.recovery_point_id = recovery_point_id self.virtual_machine_id = virtual_machine_id self.initiator_name = initiator_name self.renew_existing_registration = renew_existing_registration -class IaasVMRecoveryPoint(RecoveryPoint): +class IaasVMRecoveryPoint(RecoveryPoint): # pylint: disable=too-many-instance-attributes """IaaS VM workload specific backup copy. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_type: Type of the backup copy. :vartype recovery_point_type: str @@ -14001,26 +15202,32 @@ class IaasVMRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_additional_info': {'key': 'recoveryPointAdditionalInfo', 'type': 'str'}, - 'source_vm_storage_type': {'key': 'sourceVMStorageType', 'type': 'str'}, - 'is_source_vm_encrypted': {'key': 'isSourceVMEncrypted', 'type': 'bool'}, - 'key_and_secret': {'key': 'keyAndSecret', 'type': 'KeyAndSecretDetails'}, - 'is_instant_ilr_session_active': {'key': 'isInstantIlrSessionActive', 'type': 'bool'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformationV2]'}, - 'is_managed_virtual_machine': {'key': 'isManagedVirtualMachine', 'type': 'bool'}, - 'virtual_machine_size': {'key': 'virtualMachineSize', 'type': 'str'}, - 'original_storage_account_option': {'key': 'originalStorageAccountOption', 'type': 'bool'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'recovery_point_disk_configuration': {'key': 'recoveryPointDiskConfiguration', 'type': 'RecoveryPointDiskConfiguration'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "recovery_point_additional_info": {"key": "recoveryPointAdditionalInfo", "type": "str"}, + "source_vm_storage_type": {"key": "sourceVMStorageType", "type": "str"}, + "is_source_vm_encrypted": {"key": "isSourceVMEncrypted", "type": "bool"}, + "key_and_secret": {"key": "keyAndSecret", "type": "KeyAndSecretDetails"}, + "is_instant_ilr_session_active": {"key": "isInstantIlrSessionActive", "type": "bool"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformationV2]"}, + "is_managed_virtual_machine": {"key": "isManagedVirtualMachine", "type": "bool"}, + "virtual_machine_size": {"key": "virtualMachineSize", "type": "str"}, + "original_storage_account_option": {"key": "originalStorageAccountOption", "type": "bool"}, + "os_type": {"key": "osType", "type": "str"}, + "recovery_point_disk_configuration": { + "key": "recoveryPointDiskConfiguration", + "type": "RecoveryPointDiskConfiguration", + }, + "zones": {"key": "zones", "type": "[str]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, } def __init__( @@ -14031,16 +15238,16 @@ def __init__( recovery_point_additional_info: Optional[str] = None, source_vm_storage_type: Optional[str] = None, is_source_vm_encrypted: Optional[bool] = None, - key_and_secret: Optional["KeyAndSecretDetails"] = None, + key_and_secret: Optional["_models.KeyAndSecretDetails"] = None, is_instant_ilr_session_active: Optional[bool] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformationV2"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformationV2"]] = None, is_managed_virtual_machine: Optional[bool] = None, virtual_machine_size: Optional[str] = None, original_storage_account_option: Optional[bool] = None, os_type: Optional[str] = None, - recovery_point_disk_configuration: Optional["RecoveryPointDiskConfiguration"] = None, + recovery_point_disk_configuration: Optional["_models.RecoveryPointDiskConfiguration"] = None, zones: Optional[List[str]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, **kwargs ): """ @@ -14084,8 +15291,8 @@ def __init__( :paramtype recovery_point_move_readiness_info: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointMoveReadinessInfo] """ - super(IaasVMRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'IaasVMRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "IaasVMRecoveryPoint" # type: str self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time self.recovery_point_additional_info = recovery_point_additional_info @@ -14103,21 +15310,21 @@ def __init__( self.recovery_point_move_readiness_info = recovery_point_move_readiness_info -class IaasVMRestoreRequest(RestoreRequest): +class IaasVMRestoreRequest(RestoreRequest): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: IaasVMRestoreWithRehydrationRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + IaasVMRestoreWithRehydrationRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_id: ID of the backup copy to be recovered. :vartype recovery_point_id: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM which is being recovered. @@ -14180,42 +15387,40 @@ class IaasVMRestoreRequest(RestoreRequest): """ _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'virtual_network_id': {'key': 'virtualNetworkId', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'target_domain_name_id': {'key': 'targetDomainNameId', 'type': 'str'}, - 'region': {'key': 'region', 'type': 'str'}, - 'affinity_group': {'key': 'affinityGroup', 'type': 'str'}, - 'create_new_cloud_service': {'key': 'createNewCloudService', 'type': 'bool'}, - 'original_storage_account_option': {'key': 'originalStorageAccountOption', 'type': 'bool'}, - 'encryption_details': {'key': 'encryptionDetails', 'type': 'EncryptionDetails'}, - 'restore_disk_lun_list': {'key': 'restoreDiskLunList', 'type': '[int]'}, - 'restore_with_managed_disks': {'key': 'restoreWithManagedDisks', 'type': 'bool'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'identity_info': {'key': 'identityInfo', 'type': 'IdentityInfo'}, - 'identity_based_restore_details': {'key': 'identityBasedRestoreDetails', 'type': 'IdentityBasedRestoreDetails'}, + "object_type": {"required": True}, } - _subtype_map = { - 'object_type': {'IaasVMRestoreWithRehydrationRequest': 'IaasVMRestoreWithRehydrationRequest'} + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "virtual_network_id": {"key": "virtualNetworkId", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "target_domain_name_id": {"key": "targetDomainNameId", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "affinity_group": {"key": "affinityGroup", "type": "str"}, + "create_new_cloud_service": {"key": "createNewCloudService", "type": "bool"}, + "original_storage_account_option": {"key": "originalStorageAccountOption", "type": "bool"}, + "encryption_details": {"key": "encryptionDetails", "type": "EncryptionDetails"}, + "restore_disk_lun_list": {"key": "restoreDiskLunList", "type": "[int]"}, + "restore_with_managed_disks": {"key": "restoreWithManagedDisks", "type": "bool"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "identity_info": {"key": "identityInfo", "type": "IdentityInfo"}, + "identity_based_restore_details": {"key": "identityBasedRestoreDetails", "type": "IdentityBasedRestoreDetails"}, } + _subtype_map = {"object_type": {"IaasVMRestoreWithRehydrationRequest": "IaasVMRestoreWithRehydrationRequest"}} + def __init__( self, *, recovery_point_id: Optional[str] = None, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, target_virtual_machine_id: Optional[str] = None, target_resource_group_id: Optional[str] = None, @@ -14227,20 +15432,20 @@ def __init__( affinity_group: Optional[str] = None, create_new_cloud_service: Optional[bool] = None, original_storage_account_option: Optional[bool] = None, - encryption_details: Optional["EncryptionDetails"] = None, + encryption_details: Optional["_models.EncryptionDetails"] = None, restore_disk_lun_list: Optional[List[int]] = None, restore_with_managed_disks: Optional[bool] = None, disk_encryption_set_id: Optional[str] = None, zones: Optional[List[str]] = None, - identity_info: Optional["IdentityInfo"] = None, - identity_based_restore_details: Optional["IdentityBasedRestoreDetails"] = None, + identity_info: Optional["_models.IdentityInfo"] = None, + identity_based_restore_details: Optional["_models.IdentityBasedRestoreDetails"] = None, **kwargs ): """ :keyword recovery_point_id: ID of the backup copy to be recovered. :paramtype recovery_point_id: str - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM which is being recovered. @@ -14302,8 +15507,8 @@ def __init__( :paramtype identity_based_restore_details: ~azure.mgmt.recoveryservicesbackup.activestamp.models.IdentityBasedRestoreDetails """ - super(IaasVMRestoreRequest, self).__init__(**kwargs) - self.object_type = 'IaasVMRestoreRequest' # type: str + super().__init__(**kwargs) + self.object_type = "IaasVMRestoreRequest" # type: str self.recovery_point_id = recovery_point_id self.recovery_type = recovery_type self.source_resource_id = source_resource_id @@ -14326,18 +15531,18 @@ def __init__( self.identity_based_restore_details = identity_based_restore_details -class IaasVMRestoreWithRehydrationRequest(IaasVMRestoreRequest): +class IaasVMRestoreWithRehydrationRequest(IaasVMRestoreRequest): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific restore with integrated rehydration of recovery point. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_id: ID of the backup copy to be recovered. :vartype recovery_point_id: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM which is being recovered. @@ -14403,39 +15608,42 @@ class IaasVMRestoreWithRehydrationRequest(IaasVMRestoreRequest): """ _validation = { - 'object_type': {'required': True}, - } - - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'virtual_network_id': {'key': 'virtualNetworkId', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'target_domain_name_id': {'key': 'targetDomainNameId', 'type': 'str'}, - 'region': {'key': 'region', 'type': 'str'}, - 'affinity_group': {'key': 'affinityGroup', 'type': 'str'}, - 'create_new_cloud_service': {'key': 'createNewCloudService', 'type': 'bool'}, - 'original_storage_account_option': {'key': 'originalStorageAccountOption', 'type': 'bool'}, - 'encryption_details': {'key': 'encryptionDetails', 'type': 'EncryptionDetails'}, - 'restore_disk_lun_list': {'key': 'restoreDiskLunList', 'type': '[int]'}, - 'restore_with_managed_disks': {'key': 'restoreWithManagedDisks', 'type': 'bool'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'identity_info': {'key': 'identityInfo', 'type': 'IdentityInfo'}, - 'identity_based_restore_details': {'key': 'identityBasedRestoreDetails', 'type': 'IdentityBasedRestoreDetails'}, - 'recovery_point_rehydration_info': {'key': 'recoveryPointRehydrationInfo', 'type': 'RecoveryPointRehydrationInfo'}, + "object_type": {"required": True}, + } + + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "virtual_network_id": {"key": "virtualNetworkId", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "target_domain_name_id": {"key": "targetDomainNameId", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "affinity_group": {"key": "affinityGroup", "type": "str"}, + "create_new_cloud_service": {"key": "createNewCloudService", "type": "bool"}, + "original_storage_account_option": {"key": "originalStorageAccountOption", "type": "bool"}, + "encryption_details": {"key": "encryptionDetails", "type": "EncryptionDetails"}, + "restore_disk_lun_list": {"key": "restoreDiskLunList", "type": "[int]"}, + "restore_with_managed_disks": {"key": "restoreWithManagedDisks", "type": "bool"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "identity_info": {"key": "identityInfo", "type": "IdentityInfo"}, + "identity_based_restore_details": {"key": "identityBasedRestoreDetails", "type": "IdentityBasedRestoreDetails"}, + "recovery_point_rehydration_info": { + "key": "recoveryPointRehydrationInfo", + "type": "RecoveryPointRehydrationInfo", + }, } def __init__( self, *, recovery_point_id: Optional[str] = None, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, target_virtual_machine_id: Optional[str] = None, target_resource_group_id: Optional[str] = None, @@ -14447,21 +15655,21 @@ def __init__( affinity_group: Optional[str] = None, create_new_cloud_service: Optional[bool] = None, original_storage_account_option: Optional[bool] = None, - encryption_details: Optional["EncryptionDetails"] = None, + encryption_details: Optional["_models.EncryptionDetails"] = None, restore_disk_lun_list: Optional[List[int]] = None, restore_with_managed_disks: Optional[bool] = None, disk_encryption_set_id: Optional[str] = None, zones: Optional[List[str]] = None, - identity_info: Optional["IdentityInfo"] = None, - identity_based_restore_details: Optional["IdentityBasedRestoreDetails"] = None, - recovery_point_rehydration_info: Optional["RecoveryPointRehydrationInfo"] = None, + identity_info: Optional["_models.IdentityInfo"] = None, + identity_based_restore_details: Optional["_models.IdentityBasedRestoreDetails"] = None, + recovery_point_rehydration_info: Optional["_models.RecoveryPointRehydrationInfo"] = None, **kwargs ): """ :keyword recovery_point_id: ID of the backup copy to be recovered. :paramtype recovery_point_id: str - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM which is being recovered. @@ -14526,12 +15734,34 @@ def __init__( :paramtype recovery_point_rehydration_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointRehydrationInfo """ - super(IaasVMRestoreWithRehydrationRequest, self).__init__(recovery_point_id=recovery_point_id, recovery_type=recovery_type, source_resource_id=source_resource_id, target_virtual_machine_id=target_virtual_machine_id, target_resource_group_id=target_resource_group_id, storage_account_id=storage_account_id, virtual_network_id=virtual_network_id, subnet_id=subnet_id, target_domain_name_id=target_domain_name_id, region=region, affinity_group=affinity_group, create_new_cloud_service=create_new_cloud_service, original_storage_account_option=original_storage_account_option, encryption_details=encryption_details, restore_disk_lun_list=restore_disk_lun_list, restore_with_managed_disks=restore_with_managed_disks, disk_encryption_set_id=disk_encryption_set_id, zones=zones, identity_info=identity_info, identity_based_restore_details=identity_based_restore_details, **kwargs) - self.object_type = 'IaasVMRestoreWithRehydrationRequest' # type: str + super().__init__( + recovery_point_id=recovery_point_id, + recovery_type=recovery_type, + source_resource_id=source_resource_id, + target_virtual_machine_id=target_virtual_machine_id, + target_resource_group_id=target_resource_group_id, + storage_account_id=storage_account_id, + virtual_network_id=virtual_network_id, + subnet_id=subnet_id, + target_domain_name_id=target_domain_name_id, + region=region, + affinity_group=affinity_group, + create_new_cloud_service=create_new_cloud_service, + original_storage_account_option=original_storage_account_option, + encryption_details=encryption_details, + restore_disk_lun_list=restore_disk_lun_list, + restore_with_managed_disks=restore_with_managed_disks, + disk_encryption_set_id=disk_encryption_set_id, + zones=zones, + identity_info=identity_info, + identity_based_restore_details=identity_based_restore_details, + **kwargs + ) + self.object_type = "IaasVMRestoreWithRehydrationRequest" # type: str self.recovery_point_rehydration_info = recovery_point_rehydration_info -class IdentityBasedRestoreDetails(msrest.serialization.Model): +class IdentityBasedRestoreDetails(_serialization.Model): """IaaS VM workload specific restore details for restores using managed identity. :ivar object_type: Gets the class type. @@ -14540,30 +15770,24 @@ class IdentityBasedRestoreDetails(msrest.serialization.Model): :vartype target_storage_account_id: str """ - _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'target_storage_account_id': {'key': 'targetStorageAccountId', 'type': 'str'}, - } - - def __init__( - self, - *, - object_type: Optional[str] = None, - target_storage_account_id: Optional[str] = None, - **kwargs - ): + _attribute_map = { + "object_type": {"key": "objectType", "type": "str"}, + "target_storage_account_id": {"key": "targetStorageAccountId", "type": "str"}, + } + + def __init__(self, *, object_type: Optional[str] = None, target_storage_account_id: Optional[str] = None, **kwargs): """ :keyword object_type: Gets the class type. :paramtype object_type: str :keyword target_storage_account_id: Fully qualified ARM ID of the target storage account. :paramtype target_storage_account_id: str """ - super(IdentityBasedRestoreDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.object_type = object_type self.target_storage_account_id = target_storage_account_id -class IdentityInfo(msrest.serialization.Model): +class IdentityInfo(_serialization.Model): """Encapsulates Managed Identity related information. :ivar is_system_assigned_identity: To differentiate if the managed identity is system assigned @@ -14575,8 +15799,8 @@ class IdentityInfo(msrest.serialization.Model): """ _attribute_map = { - 'is_system_assigned_identity': {'key': 'isSystemAssignedIdentity', 'type': 'bool'}, - 'managed_identity_resource_id': {'key': 'managedIdentityResourceId', 'type': 'str'}, + "is_system_assigned_identity": {"key": "isSystemAssignedIdentity", "type": "bool"}, + "managed_identity_resource_id": {"key": "managedIdentityResourceId", "type": "str"}, } def __init__( @@ -14594,7 +15818,7 @@ def __init__( Optional: Might not be required in the case of system assigned managed identity. :paramtype managed_identity_resource_id: str """ - super(IdentityInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_system_assigned_identity = is_system_assigned_identity self.managed_identity_resource_id = managed_identity_resource_id @@ -14613,7 +15837,7 @@ class ILRRequestResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -14622,19 +15846,19 @@ class ILRRequestResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ILRRequest'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ILRRequest"}, } def __init__( @@ -14643,24 +15867,24 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ILRRequest"] = None, + properties: Optional["_models.ILRRequest"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: ILRRequestResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ILRRequest """ - super(ILRRequestResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class InquiryInfo(msrest.serialization.Model): +class InquiryInfo(_serialization.Model): """Details about inquired protectable items under a given container. :ivar status: Inquiry Status for this container such as @@ -14675,17 +15899,17 @@ class InquiryInfo(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error_detail': {'key': 'errorDetail', 'type': 'ErrorDetail'}, - 'inquiry_details': {'key': 'inquiryDetails', 'type': '[WorkloadInquiryDetails]'}, + "status": {"key": "status", "type": "str"}, + "error_detail": {"key": "errorDetail", "type": "ErrorDetail"}, + "inquiry_details": {"key": "inquiryDetails", "type": "[WorkloadInquiryDetails]"}, } def __init__( self, *, status: Optional[str] = None, - error_detail: Optional["ErrorDetail"] = None, - inquiry_details: Optional[List["WorkloadInquiryDetails"]] = None, + error_detail: Optional["_models.ErrorDetail"] = None, + inquiry_details: Optional[List["_models.WorkloadInquiryDetails"]] = None, **kwargs ): """ @@ -14699,13 +15923,13 @@ def __init__( :paramtype inquiry_details: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadInquiryDetails] """ - super(InquiryInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.error_detail = error_detail self.inquiry_details = inquiry_details -class InquiryValidation(msrest.serialization.Model): +class InquiryValidation(_serialization.Model): """Validation for inquired protectable items under a given container. Variables are only populated by the server, and will be ignored when sending a request. @@ -14719,35 +15943,29 @@ class InquiryValidation(msrest.serialization.Model): """ _validation = { - 'additional_detail': {'readonly': True}, + "additional_detail": {"readonly": True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error_detail': {'key': 'errorDetail', 'type': 'ErrorDetail'}, - 'additional_detail': {'key': 'additionalDetail', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "error_detail": {"key": "errorDetail", "type": "ErrorDetail"}, + "additional_detail": {"key": "additionalDetail", "type": "str"}, } - def __init__( - self, - *, - status: Optional[str] = None, - error_detail: Optional["ErrorDetail"] = None, - **kwargs - ): + def __init__(self, *, status: Optional[str] = None, error_detail: Optional["_models.ErrorDetail"] = None, **kwargs): """ :keyword status: Status for the Inquiry Validation. :paramtype status: str :keyword error_detail: Error Detail in case the status is non-success. :paramtype error_detail: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ErrorDetail """ - super(InquiryValidation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.error_detail = error_detail self.additional_detail = None -class InstantItemRecoveryTarget(msrest.serialization.Model): +class InstantItemRecoveryTarget(_serialization.Model): """Target details for file / folder restore. :ivar client_scripts: List of client scripts. @@ -14756,25 +15974,20 @@ class InstantItemRecoveryTarget(msrest.serialization.Model): """ _attribute_map = { - 'client_scripts': {'key': 'clientScripts', 'type': '[ClientScriptForConnect]'}, + "client_scripts": {"key": "clientScripts", "type": "[ClientScriptForConnect]"}, } - def __init__( - self, - *, - client_scripts: Optional[List["ClientScriptForConnect"]] = None, - **kwargs - ): + def __init__(self, *, client_scripts: Optional[List["_models.ClientScriptForConnect"]] = None, **kwargs): """ :keyword client_scripts: List of client scripts. :paramtype client_scripts: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientScriptForConnect] """ - super(InstantItemRecoveryTarget, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_scripts = client_scripts -class InstantRPAdditionalDetails(msrest.serialization.Model): +class InstantRPAdditionalDetails(_serialization.Model): """InstantRPAdditionalDetails. :ivar azure_backup_rg_name_prefix: @@ -14784,8 +15997,8 @@ class InstantRPAdditionalDetails(msrest.serialization.Model): """ _attribute_map = { - 'azure_backup_rg_name_prefix': {'key': 'azureBackupRGNamePrefix', 'type': 'str'}, - 'azure_backup_rg_name_suffix': {'key': 'azureBackupRGNameSuffix', 'type': 'str'}, + "azure_backup_rg_name_prefix": {"key": "azureBackupRGNamePrefix", "type": "str"}, + "azure_backup_rg_name_suffix": {"key": "azureBackupRGNameSuffix", "type": "str"}, } def __init__( @@ -14801,25 +16014,25 @@ def __init__( :keyword azure_backup_rg_name_suffix: :paramtype azure_backup_rg_name_suffix: str """ - super(InstantRPAdditionalDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.azure_backup_rg_name_prefix = azure_backup_rg_name_prefix self.azure_backup_rg_name_suffix = azure_backup_rg_name_suffix -class JobQueryObject(msrest.serialization.Model): +class JobQueryObject(_serialization.Model): """Filters to list the jobs. - :ivar status: Status of the job. Possible values include: "Invalid", "InProgress", "Completed", - "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + :ivar status: Status of the job. Known values are: "Invalid", "InProgress", "Completed", + "Failed", "CompletedWithWarnings", "Cancelled", and "Cancelling". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobStatus - :ivar backup_management_type: Type of backup management for the job. Possible values include: + :ivar backup_management_type: Type of backup management for the job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar operation: Type of operation. Possible values include: "Invalid", "Register", - "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + :ivar operation: Type of operation. Known values are: "Invalid", "Register", "UnRegister", + "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :vartype operation: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobOperationType :ivar job_id: JobID represents the job uniquely. @@ -14831,37 +16044,37 @@ class JobQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + "status": {"key": "status", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, } def __init__( self, *, - status: Optional[Union[str, "JobStatus"]] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - operation: Optional[Union[str, "JobOperationType"]] = None, + status: Optional[Union[str, "_models.JobStatus"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + operation: Optional[Union[str, "_models.JobOperationType"]] = None, job_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword status: Status of the job. Possible values include: "Invalid", "InProgress", - "Completed", "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + :keyword status: Status of the job. Known values are: "Invalid", "InProgress", "Completed", + "Failed", "CompletedWithWarnings", "Cancelled", and "Cancelling". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobStatus - :keyword backup_management_type: Type of backup management for the job. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the job. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword operation: Type of operation. Possible values include: "Invalid", "Register", - "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + :keyword operation: Type of operation. Known values are: "Invalid", "Register", "UnRegister", + "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :paramtype operation: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobOperationType :keyword job_id: JobID represents the job uniquely. @@ -14871,7 +16084,7 @@ def __init__( :keyword end_time: Job has ended at this time. Value is in UTC. :paramtype end_time: ~datetime.datetime """ - super(JobQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.backup_management_type = backup_management_type self.operation = operation @@ -14894,7 +16107,7 @@ class JobResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -14903,19 +16116,19 @@ class JobResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'Job'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "Job"}, } def __init__( @@ -14924,20 +16137,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["Job"] = None, + properties: Optional["_models.Job"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: JobResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.Job """ - super(JobResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -14952,16 +16165,12 @@ class JobResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[JobResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[JobResource]"}, } def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["JobResource"]] = None, - **kwargs + self, *, next_link: Optional[str] = None, value: Optional[List["_models.JobResource"]] = None, **kwargs ): """ :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next @@ -14970,11 +16179,11 @@ def __init__( :keyword value: List of resources. :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource] """ - super(JobResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class KEKDetails(msrest.serialization.Model): +class KEKDetails(_serialization.Model): """KEK is encryption key for BEK. :ivar key_url: Key is KEK. @@ -14986,9 +16195,9 @@ class KEKDetails(msrest.serialization.Model): """ _attribute_map = { - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - 'key_backup_data': {'key': 'keyBackupData', 'type': 'str'}, + "key_url": {"key": "keyUrl", "type": "str"}, + "key_vault_id": {"key": "keyVaultId", "type": "str"}, + "key_backup_data": {"key": "keyBackupData", "type": "str"}, } def __init__( @@ -15007,42 +16216,42 @@ def __init__( :keyword key_backup_data: KEK data. :paramtype key_backup_data: str """ - super(KEKDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_url = key_url self.key_vault_id = key_vault_id self.key_backup_data = key_backup_data -class KeyAndSecretDetails(msrest.serialization.Model): +class KeyAndSecretDetails(_serialization.Model): """BEK is bitlocker key. -KEK is encryption key for BEK -If the VM was encrypted then we will store following details : + KEK is encryption key for BEK + If the VM was encrypted then we will store following details : -#. Secret(BEK) - Url + Backup Data + vaultId. -#. Key(KEK) - Url + Backup Data + vaultId. -#. EncryptionMechanism - BEK and KEK can potentially have different vault ids. + #. Secret(BEK) - Url + Backup Data + vaultId. + #. Key(KEK) - Url + Backup Data + vaultId. + #. EncryptionMechanism + BEK and KEK can potentially have different vault ids. - :ivar kek_details: KEK is encryption key for BEK. - :vartype kek_details: ~azure.mgmt.recoveryservicesbackup.activestamp.models.KEKDetails - :ivar bek_details: BEK is bitlocker encryption key. - :vartype bek_details: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BEKDetails - :ivar encryption_mechanism: Encryption mechanism: None/ SinglePass/ DoublePass. - :vartype encryption_mechanism: str + :ivar kek_details: KEK is encryption key for BEK. + :vartype kek_details: ~azure.mgmt.recoveryservicesbackup.activestamp.models.KEKDetails + :ivar bek_details: BEK is bitlocker encryption key. + :vartype bek_details: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BEKDetails + :ivar encryption_mechanism: Encryption mechanism: None/ SinglePass/ DoublePass. + :vartype encryption_mechanism: str """ _attribute_map = { - 'kek_details': {'key': 'kekDetails', 'type': 'KEKDetails'}, - 'bek_details': {'key': 'bekDetails', 'type': 'BEKDetails'}, - 'encryption_mechanism': {'key': 'encryptionMechanism', 'type': 'str'}, + "kek_details": {"key": "kekDetails", "type": "KEKDetails"}, + "bek_details": {"key": "bekDetails", "type": "BEKDetails"}, + "encryption_mechanism": {"key": "encryptionMechanism", "type": "str"}, } def __init__( self, *, - kek_details: Optional["KEKDetails"] = None, - bek_details: Optional["BEKDetails"] = None, + kek_details: Optional["_models.KEKDetails"] = None, + bek_details: Optional["_models.BEKDetails"] = None, encryption_mechanism: Optional[str] = None, **kwargs ): @@ -15054,17 +16263,17 @@ def __init__( :keyword encryption_mechanism: Encryption mechanism: None/ SinglePass/ DoublePass. :paramtype encryption_mechanism: str """ - super(KeyAndSecretDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.kek_details = kek_details self.bek_details = bek_details self.encryption_mechanism = encryption_mechanism -class KPIResourceHealthDetails(msrest.serialization.Model): +class KPIResourceHealthDetails(_serialization.Model): """KPI Resource Health Details. - :ivar resource_health_status: Resource Health Status. Possible values include: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + :ivar resource_health_status: Resource Health Status. Known values are: "Healthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :vartype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceHealthStatus @@ -15074,20 +16283,20 @@ class KPIResourceHealthDetails(msrest.serialization.Model): """ _attribute_map = { - 'resource_health_status': {'key': 'resourceHealthStatus', 'type': 'str'}, - 'resource_health_details': {'key': 'resourceHealthDetails', 'type': '[ResourceHealthDetails]'}, + "resource_health_status": {"key": "resourceHealthStatus", "type": "str"}, + "resource_health_details": {"key": "resourceHealthDetails", "type": "[ResourceHealthDetails]"}, } def __init__( self, *, - resource_health_status: Optional[Union[str, "ResourceHealthStatus"]] = None, - resource_health_details: Optional[List["ResourceHealthDetails"]] = None, + resource_health_status: Optional[Union[str, "_models.ResourceHealthStatus"]] = None, + resource_health_details: Optional[List["_models.ResourceHealthDetails"]] = None, **kwargs ): """ - :keyword resource_health_status: Resource Health Status. Possible values include: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + :keyword resource_health_status: Resource Health Status. Known values are: "Healthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :paramtype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceHealthStatus @@ -15095,12 +16304,12 @@ def __init__( :paramtype resource_health_details: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceHealthDetails] """ - super(KPIResourceHealthDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_health_status = resource_health_status self.resource_health_details = resource_health_details -class ListRecoveryPointsRecommendedForMoveRequest(msrest.serialization.Model): +class ListRecoveryPointsRecommendedForMoveRequest(_serialization.Model): """ListRecoveryPointsRecommendedForMoveRequest Request. :ivar object_type: Gets the class type. @@ -15110,60 +16319,55 @@ class ListRecoveryPointsRecommendedForMoveRequest(msrest.serialization.Model): """ _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'excluded_rp_list': {'key': 'excludedRPList', 'type': '[str]'}, + "object_type": {"key": "objectType", "type": "str"}, + "excluded_rp_list": {"key": "excludedRPList", "type": "[str]"}, } - def __init__( - self, - *, - object_type: Optional[str] = None, - excluded_rp_list: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, object_type: Optional[str] = None, excluded_rp_list: Optional[List[str]] = None, **kwargs): """ :keyword object_type: Gets the class type. :paramtype object_type: str :keyword excluded_rp_list: List of Recovery Points excluded from Move. :paramtype excluded_rp_list: list[str] """ - super(ListRecoveryPointsRecommendedForMoveRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.object_type = object_type self.excluded_rp_list = excluded_rp_list -class SchedulePolicy(msrest.serialization.Model): +class SchedulePolicy(_serialization.Model): """Base class for backup schedule. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: LogSchedulePolicy, LongTermSchedulePolicy, SimpleSchedulePolicy, SimpleSchedulePolicyV2. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LogSchedulePolicy, LongTermSchedulePolicy, SimpleSchedulePolicy, SimpleSchedulePolicyV2 All required parameters must be populated in order to send to Azure. - :ivar schedule_policy_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. + :ivar schedule_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype schedule_policy_type: str """ _validation = { - 'schedule_policy_type': {'required': True}, + "schedule_policy_type": {"required": True}, } _attribute_map = { - 'schedule_policy_type': {'key': 'schedulePolicyType', 'type': 'str'}, + "schedule_policy_type": {"key": "schedulePolicyType", "type": "str"}, } _subtype_map = { - 'schedule_policy_type': {'LogSchedulePolicy': 'LogSchedulePolicy', 'LongTermSchedulePolicy': 'LongTermSchedulePolicy', 'SimpleSchedulePolicy': 'SimpleSchedulePolicy', 'SimpleSchedulePolicyV2': 'SimpleSchedulePolicyV2'} + "schedule_policy_type": { + "LogSchedulePolicy": "LogSchedulePolicy", + "LongTermSchedulePolicy": "LongTermSchedulePolicy", + "SimpleSchedulePolicy": "SimpleSchedulePolicy", + "SimpleSchedulePolicyV2": "SimpleSchedulePolicyV2", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(SchedulePolicy, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.schedule_policy_type = None # type: Optional[str] @@ -15172,8 +16376,8 @@ class LogSchedulePolicy(SchedulePolicy): All required parameters must be populated in order to send to Azure. - :ivar schedule_policy_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. + :ivar schedule_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype schedule_policy_type: str :ivar schedule_frequency_in_mins: Frequency of the log schedule operation of this policy in minutes. @@ -15181,62 +16385,56 @@ class LogSchedulePolicy(SchedulePolicy): """ _validation = { - 'schedule_policy_type': {'required': True}, + "schedule_policy_type": {"required": True}, } _attribute_map = { - 'schedule_policy_type': {'key': 'schedulePolicyType', 'type': 'str'}, - 'schedule_frequency_in_mins': {'key': 'scheduleFrequencyInMins', 'type': 'int'}, + "schedule_policy_type": {"key": "schedulePolicyType", "type": "str"}, + "schedule_frequency_in_mins": {"key": "scheduleFrequencyInMins", "type": "int"}, } - def __init__( - self, - *, - schedule_frequency_in_mins: Optional[int] = None, - **kwargs - ): + def __init__(self, *, schedule_frequency_in_mins: Optional[int] = None, **kwargs): """ :keyword schedule_frequency_in_mins: Frequency of the log schedule operation of this policy in minutes. :paramtype schedule_frequency_in_mins: int """ - super(LogSchedulePolicy, self).__init__(**kwargs) - self.schedule_policy_type = 'LogSchedulePolicy' # type: str + super().__init__(**kwargs) + self.schedule_policy_type = "LogSchedulePolicy" # type: str self.schedule_frequency_in_mins = schedule_frequency_in_mins -class RetentionPolicy(msrest.serialization.Model): +class RetentionPolicy(_serialization.Model): """Base class for retention policy. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: LongTermRetentionPolicy, SimpleRetentionPolicy. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LongTermRetentionPolicy, SimpleRetentionPolicy All required parameters must be populated in order to send to Azure. - :ivar retention_policy_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. + :ivar retention_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype retention_policy_type: str """ _validation = { - 'retention_policy_type': {'required': True}, + "retention_policy_type": {"required": True}, } _attribute_map = { - 'retention_policy_type': {'key': 'retentionPolicyType', 'type': 'str'}, + "retention_policy_type": {"key": "retentionPolicyType", "type": "str"}, } _subtype_map = { - 'retention_policy_type': {'LongTermRetentionPolicy': 'LongTermRetentionPolicy', 'SimpleRetentionPolicy': 'SimpleRetentionPolicy'} + "retention_policy_type": { + "LongTermRetentionPolicy": "LongTermRetentionPolicy", + "SimpleRetentionPolicy": "SimpleRetentionPolicy", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(RetentionPolicy, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.retention_policy_type = None # type: Optional[str] @@ -15245,8 +16443,8 @@ class LongTermRetentionPolicy(RetentionPolicy): All required parameters must be populated in order to send to Azure. - :ivar retention_policy_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. + :ivar retention_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype retention_policy_type: str :ivar daily_schedule: Daily retention schedule of the protection policy. :vartype daily_schedule: @@ -15263,24 +16461,24 @@ class LongTermRetentionPolicy(RetentionPolicy): """ _validation = { - 'retention_policy_type': {'required': True}, + "retention_policy_type": {"required": True}, } _attribute_map = { - 'retention_policy_type': {'key': 'retentionPolicyType', 'type': 'str'}, - 'daily_schedule': {'key': 'dailySchedule', 'type': 'DailyRetentionSchedule'}, - 'weekly_schedule': {'key': 'weeklySchedule', 'type': 'WeeklyRetentionSchedule'}, - 'monthly_schedule': {'key': 'monthlySchedule', 'type': 'MonthlyRetentionSchedule'}, - 'yearly_schedule': {'key': 'yearlySchedule', 'type': 'YearlyRetentionSchedule'}, + "retention_policy_type": {"key": "retentionPolicyType", "type": "str"}, + "daily_schedule": {"key": "dailySchedule", "type": "DailyRetentionSchedule"}, + "weekly_schedule": {"key": "weeklySchedule", "type": "WeeklyRetentionSchedule"}, + "monthly_schedule": {"key": "monthlySchedule", "type": "MonthlyRetentionSchedule"}, + "yearly_schedule": {"key": "yearlySchedule", "type": "YearlyRetentionSchedule"}, } def __init__( self, *, - daily_schedule: Optional["DailyRetentionSchedule"] = None, - weekly_schedule: Optional["WeeklyRetentionSchedule"] = None, - monthly_schedule: Optional["MonthlyRetentionSchedule"] = None, - yearly_schedule: Optional["YearlyRetentionSchedule"] = None, + daily_schedule: Optional["_models.DailyRetentionSchedule"] = None, + weekly_schedule: Optional["_models.WeeklyRetentionSchedule"] = None, + monthly_schedule: Optional["_models.MonthlyRetentionSchedule"] = None, + yearly_schedule: Optional["_models.YearlyRetentionSchedule"] = None, **kwargs ): """ @@ -15297,8 +16495,8 @@ def __init__( :paramtype yearly_schedule: ~azure.mgmt.recoveryservicesbackup.activestamp.models.YearlyRetentionSchedule """ - super(LongTermRetentionPolicy, self).__init__(**kwargs) - self.retention_policy_type = 'LongTermRetentionPolicy' # type: str + super().__init__(**kwargs) + self.retention_policy_type = "LongTermRetentionPolicy" # type: str self.daily_schedule = daily_schedule self.weekly_schedule = weekly_schedule self.monthly_schedule = monthly_schedule @@ -15310,39 +16508,35 @@ class LongTermSchedulePolicy(SchedulePolicy): All required parameters must be populated in order to send to Azure. - :ivar schedule_policy_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. + :ivar schedule_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype schedule_policy_type: str """ _validation = { - 'schedule_policy_type': {'required': True}, + "schedule_policy_type": {"required": True}, } _attribute_map = { - 'schedule_policy_type': {'key': 'schedulePolicyType', 'type': 'str'}, + "schedule_policy_type": {"key": "schedulePolicyType", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(LongTermSchedulePolicy, self).__init__(**kwargs) - self.schedule_policy_type = 'LongTermSchedulePolicy' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.schedule_policy_type = "LongTermSchedulePolicy" # type: str -class MabContainer(ProtectionContainer): +class MabContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes """Container with items backed up using MAB backup engine. All required parameters must be populated in order to send to Azure. :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str - :ivar backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar registration_status: Status of registration of the container with the Recovery Services @@ -15350,28 +16544,28 @@ class MabContainer(ProtectionContainer): :vartype registration_status: str :ivar health_status: Status of health of the container. :vartype health_status: str - :ivar container_type: Required. Type of the container. The value of this property for: 1. - Compute Azure VM is Microsoft.Compute/virtualMachines 2. + :ivar container_type: Type of the container. The value of this property for: 1. Compute Azure + VM is Microsoft.Compute/virtualMachines 2. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines 3. Windows machines (like MAB, DPM etc) is Windows 4. Azure SQL instance is AzureSqlContainer. 5. Storage containers is StorageContainer. 6. Azure workload - Backup is VMAppContainer.Constant filled by server. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", - "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", + Backup is VMAppContainer. Required. Known values are: "Invalid", "Unknown", "IaasVMContainer", + "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", "MABContainer", + "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType :ivar protectable_object_type: Type of the protectable object associated with this container. :vartype protectable_object_type: str :ivar can_re_register: Can the container be registered one more time. :vartype can_re_register: bool :ivar container_id: ContainerID represents the container. - :vartype container_id: long + :vartype container_id: int :ivar protected_item_count: Number of items backed up in this container. - :vartype protected_item_count: long + :vartype protected_item_count: int :ivar agent_version: Agent version of this container. :vartype agent_version: str :ivar extended_info: Additional information for this container. @@ -15385,30 +16579,30 @@ class MabContainer(ProtectionContainer): """ _validation = { - 'container_type': {'required': True}, + "container_type": {"required": True}, } _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'registration_status': {'key': 'registrationStatus', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'protectable_object_type': {'key': 'protectableObjectType', 'type': 'str'}, - 'can_re_register': {'key': 'canReRegister', 'type': 'bool'}, - 'container_id': {'key': 'containerId', 'type': 'long'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'long'}, - 'agent_version': {'key': 'agentVersion', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'MabContainerExtendedInfo'}, - 'mab_container_health_details': {'key': 'mabContainerHealthDetails', 'type': '[MABContainerHealthDetails]'}, - 'container_health_state': {'key': 'containerHealthState', 'type': 'str'}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "registration_status": {"key": "registrationStatus", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "protectable_object_type": {"key": "protectableObjectType", "type": "str"}, + "can_re_register": {"key": "canReRegister", "type": "bool"}, + "container_id": {"key": "containerId", "type": "int"}, + "protected_item_count": {"key": "protectedItemCount", "type": "int"}, + "agent_version": {"key": "agentVersion", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "MabContainerExtendedInfo"}, + "mab_container_health_details": {"key": "mabContainerHealthDetails", "type": "[MABContainerHealthDetails]"}, + "container_health_state": {"key": "containerHealthState", "type": "str"}, } def __init__( self, *, friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, registration_status: Optional[str] = None, health_status: Optional[str] = None, protectable_object_type: Optional[str] = None, @@ -15416,17 +16610,17 @@ def __init__( container_id: Optional[int] = None, protected_item_count: Optional[int] = None, agent_version: Optional[str] = None, - extended_info: Optional["MabContainerExtendedInfo"] = None, - mab_container_health_details: Optional[List["MABContainerHealthDetails"]] = None, + extended_info: Optional["_models.MabContainerExtendedInfo"] = None, + mab_container_health_details: Optional[List["_models.MABContainerHealthDetails"]] = None, container_health_state: Optional[str] = None, **kwargs ): """ :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str - :keyword backup_management_type: Type of backup management for the container. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the container. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword registration_status: Status of registration of the container with the Recovery @@ -15440,9 +16634,9 @@ def __init__( :keyword can_re_register: Can the container be registered one more time. :paramtype can_re_register: bool :keyword container_id: ContainerID represents the container. - :paramtype container_id: long + :paramtype container_id: int :keyword protected_item_count: Number of items backed up in this container. - :paramtype protected_item_count: long + :paramtype protected_item_count: int :keyword agent_version: Agent version of this container. :paramtype agent_version: str :keyword extended_info: Additional information for this container. @@ -15454,8 +16648,15 @@ def __init__( :keyword container_health_state: Health state of mab container. :paramtype container_health_state: str """ - super(MabContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'Windows' # type: str + super().__init__( + friendly_name=friendly_name, + backup_management_type=backup_management_type, + registration_status=registration_status, + health_status=health_status, + protectable_object_type=protectable_object_type, + **kwargs + ) + self.container_type = "Windows" # type: str self.can_re_register = can_re_register self.container_id = container_id self.protected_item_count = protected_item_count @@ -15465,15 +16666,15 @@ def __init__( self.container_health_state = container_health_state -class MabContainerExtendedInfo(msrest.serialization.Model): +class MabContainerExtendedInfo(_serialization.Model): """Additional information of the container. :ivar last_refreshed_at: Time stamp when this container was refreshed. :vartype last_refreshed_at: ~datetime.datetime - :ivar backup_item_type: Type of backup items associated with this container. Possible values - include: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", - "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :ivar backup_item_type: Type of backup items associated with this container. Known values are: + "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", + "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype backup_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupItemType :ivar backup_items: List of backup items associated with this container. @@ -15485,18 +16686,18 @@ class MabContainerExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'last_refreshed_at': {'key': 'lastRefreshedAt', 'type': 'iso-8601'}, - 'backup_item_type': {'key': 'backupItemType', 'type': 'str'}, - 'backup_items': {'key': 'backupItems', 'type': '[str]'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, + "last_refreshed_at": {"key": "lastRefreshedAt", "type": "iso-8601"}, + "backup_item_type": {"key": "backupItemType", "type": "str"}, + "backup_items": {"key": "backupItems", "type": "[str]"}, + "policy_name": {"key": "policyName", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, } def __init__( self, *, last_refreshed_at: Optional[datetime.datetime] = None, - backup_item_type: Optional[Union[str, "BackupItemType"]] = None, + backup_item_type: Optional[Union[str, "_models.BackupItemType"]] = None, backup_items: Optional[List[str]] = None, policy_name: Optional[str] = None, last_backup_status: Optional[str] = None, @@ -15505,10 +16706,10 @@ def __init__( """ :keyword last_refreshed_at: Time stamp when this container was refreshed. :paramtype last_refreshed_at: ~datetime.datetime - :keyword backup_item_type: Type of backup items associated with this container. Possible values - include: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", + :keyword backup_item_type: Type of backup items associated with this container. Known values + are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype backup_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupItemType :keyword backup_items: List of backup items associated with this container. @@ -15518,7 +16719,7 @@ def __init__( :keyword last_backup_status: Latest backup status of this container. :paramtype last_backup_status: str """ - super(MabContainerExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.last_refreshed_at = last_refreshed_at self.backup_item_type = backup_item_type self.backup_items = backup_items @@ -15526,7 +16727,7 @@ def __init__( self.last_backup_status = last_backup_status -class MABContainerHealthDetails(msrest.serialization.Model): +class MABContainerHealthDetails(_serialization.Model): """MAB workload-specific Health Details. :ivar code: Health Code. @@ -15540,10 +16741,10 @@ class MABContainerHealthDetails(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'int'}, - 'title': {'key': 'title', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "int"}, + "title": {"key": "title", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } def __init__( @@ -15565,14 +16766,14 @@ def __init__( :keyword recommendations: Health Recommended Actions. :paramtype recommendations: list[str] """ - super(MABContainerHealthDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.title = title self.message = message self.recommendations = recommendations -class MabErrorInfo(msrest.serialization.Model): +class MabErrorInfo(_serialization.Model): """MAB workload-specific error information. Variables are only populated by the server, and will be ignored when sending a request. @@ -15584,42 +16785,40 @@ class MabErrorInfo(msrest.serialization.Model): """ _validation = { - 'error_string': {'readonly': True}, - 'recommendations': {'readonly': True}, + "error_string": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MabErrorInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error_string = None self.recommendations = None -class MabFileFolderProtectedItem(ProtectedItem): +class MabFileFolderProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """MAB workload-specific backup item. + 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 protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -15634,7 +16833,7 @@ class MabFileFolderProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -15667,54 +16866,54 @@ class MabFileFolderProtectedItem(ProtectedItem): :ivar protection_state: Protected, ProtectionStopped, IRPending or ProtectionError. :vartype protection_state: str :ivar deferred_delete_sync_time_in_utc: Sync time for deferred deletion in UTC. - :vartype deferred_delete_sync_time_in_utc: long + :vartype deferred_delete_sync_time_in_utc: int :ivar extended_info: Additional information with this backup item. :vartype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabFileFolderProtectedItemExtendedInfo """ _validation = { - 'protected_item_type': {'required': True}, - } - - _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'is_archive_enabled': {'key': 'isArchiveEnabled', 'type': 'bool'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'computer_name': {'key': 'computerName', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'deferred_delete_sync_time_in_utc': {'key': 'deferredDeleteSyncTimeInUTC', 'type': 'long'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'MabFileFolderProtectedItemExtendedInfo'}, - } - - def __init__( + "protected_item_type": {"required": True}, + "backup_management_type": {"readonly": True}, + "workload_type": {"readonly": True}, + } + + _attribute_map = { + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, + "policy_name": {"key": "policyName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "computer_name": {"key": "computerName", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "deferred_delete_sync_time_in_utc": {"key": "deferredDeleteSyncTimeInUTC", "type": "int"}, + "extended_info": {"key": "extendedInfo", "type": "MabFileFolderProtectedItemExtendedInfo"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -15729,21 +16928,10 @@ def __init__( last_backup_time: Optional[datetime.datetime] = None, protection_state: Optional[str] = None, deferred_delete_sync_time_in_utc: Optional[int] = None, - extended_info: Optional["MabFileFolderProtectedItemExtendedInfo"] = None, + extended_info: Optional["_models.MabFileFolderProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". - :paramtype backup_management_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :paramtype workload_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword container_name: Unique name of container. :paramtype container_name: str :keyword source_resource_id: ARM ID of the resource to be backed up. @@ -15756,7 +16944,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. :paramtype deferred_delete_time_in_utc: ~datetime.datetime @@ -15790,13 +16978,29 @@ def __init__( :keyword protection_state: Protected, ProtectionStopped, IRPending or ProtectionError. :paramtype protection_state: str :keyword deferred_delete_sync_time_in_utc: Sync time for deferred deletion in UTC. - :paramtype deferred_delete_sync_time_in_utc: long + :paramtype deferred_delete_sync_time_in_utc: int :keyword extended_info: Additional information with this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabFileFolderProtectedItemExtendedInfo """ - super(MabFileFolderProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, is_archive_enabled=is_archive_enabled, policy_name=policy_name, **kwargs) - self.protected_item_type = 'MabFileFolderProtectedItem' # type: str + super().__init__( + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + is_archive_enabled=is_archive_enabled, + policy_name=policy_name, + **kwargs + ) + self.protected_item_type = "MabFileFolderProtectedItem" # type: str self.friendly_name = friendly_name self.computer_name = computer_name self.last_backup_status = last_backup_status @@ -15806,7 +17010,7 @@ def __init__( self.extended_info = extended_info -class MabFileFolderProtectedItemExtendedInfo(msrest.serialization.Model): +class MabFileFolderProtectedItemExtendedInfo(_serialization.Model): """Additional information on the backed up item. :ivar last_refreshed_at: Last time when the agent data synced to service. @@ -15818,9 +17022,9 @@ class MabFileFolderProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'last_refreshed_at': {'key': 'lastRefreshedAt', 'type': 'iso-8601'}, - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, + "last_refreshed_at": {"key": "lastRefreshedAt", "type": "iso-8601"}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, } def __init__( @@ -15839,22 +17043,22 @@ def __init__( :keyword recovery_point_count: Number of backup copies associated with the backup item. :paramtype recovery_point_count: int """ - super(MabFileFolderProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.last_refreshed_at = last_refreshed_at self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count -class MabJob(Job): +class MabJob(Job): # pylint: disable=too-many-instance-attributes """MAB workload-specific job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -15867,8 +17071,8 @@ class MabJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time taken by job to run. :vartype duration: ~datetime.timedelta @@ -15877,16 +17081,16 @@ class MabJob(Job): ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobSupportedAction] :ivar mab_server_name: Name of server protecting the DS. :vartype mab_server_name: str - :ivar mab_server_type: Server type of MAB container. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer". + :ivar mab_server_type: Server type of MAB container. Known values are: "Invalid", "Unknown", + "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", + "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :vartype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabServerType - :ivar workload_type: Workload type of backup item. Possible values include: "Invalid", "VM", + :ivar workload_type: Workload type of backup item. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :ivar error_details: The errors. @@ -15898,53 +17102,53 @@ class MabJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'mab_server_name': {'key': 'mabServerName', 'type': 'str'}, - 'mab_server_type': {'key': 'mabServerType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'error_details': {'key': 'errorDetails', 'type': '[MabErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'MabJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "mab_server_name": {"key": "mabServerName", "type": "str"}, + "mab_server_type": {"key": "mabServerType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "error_details": {"key": "errorDetails", "type": "[MabErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "MabJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, mab_server_name: Optional[str] = None, - mab_server_type: Optional[Union[str, "MabServerType"]] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, - error_details: Optional[List["MabErrorInfo"]] = None, - extended_info: Optional["MabJobExtendedInfo"] = None, + mab_server_type: Optional[Union[str, "_models.MabServerType"]] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, + error_details: Optional[List["_models.MabErrorInfo"]] = None, + extended_info: Optional["_models.MabJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -15964,16 +17168,16 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobSupportedAction] :keyword mab_server_name: Name of server protecting the DS. :paramtype mab_server_name: str - :keyword mab_server_type: Server type of MAB container. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer". + :keyword mab_server_type: Server type of MAB container. Known values are: "Invalid", "Unknown", + "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", + "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :paramtype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabServerType - :keyword workload_type: Workload type of backup item. Possible values include: "Invalid", "VM", + :keyword workload_type: Workload type of backup item. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :keyword error_details: The errors. @@ -15983,8 +17187,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabJobExtendedInfo """ - super(MabJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'MabJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "MabJob" # type: str self.duration = duration self.actions_info = actions_info self.mab_server_name = mab_server_name @@ -15994,7 +17207,7 @@ def __init__( self.extended_info = extended_info -class MabJobExtendedInfo(msrest.serialization.Model): +class MabJobExtendedInfo(_serialization.Model): """Additional information for the MAB workload-specific job. :ivar tasks_list: List of tasks for this job. @@ -16007,15 +17220,15 @@ class MabJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[MabJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[MabJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["MabJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.MabJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -16029,13 +17242,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message specific to this job. :paramtype dynamic_error_message: str """ - super(MabJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class MabJobTaskDetails(msrest.serialization.Model): +class MabJobTaskDetails(_serialization.Model): """MAB workload-specific job task details. :ivar task_id: The task display name. @@ -16051,11 +17264,11 @@ class MabJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "duration": {"key": "duration", "type": "duration"}, + "status": {"key": "status", "type": "str"}, } def __init__( @@ -16080,7 +17293,7 @@ def __init__( :keyword status: The status. :paramtype status: str """ - super(MabJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.start_time = start_time self.end_time = end_time @@ -16095,8 +17308,8 @@ class MabProtectionPolicy(ProtectionPolicy): :ivar protected_items_count: Number of items associated with this policy. :vartype protected_items_count: int - :ivar backup_management_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. + :ivar backup_management_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype backup_management_type: str :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. :vartype resource_guard_operation_requests: list[str] @@ -16108,15 +17321,15 @@ class MabProtectionPolicy(ProtectionPolicy): """ _validation = { - 'backup_management_type': {'required': True}, + "backup_management_type": {"required": True}, } _attribute_map = { - 'protected_items_count': {'key': 'protectedItemsCount', 'type': 'int'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + "protected_items_count": {"key": "protectedItemsCount", "type": "int"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "schedule_policy": {"key": "schedulePolicy", "type": "SchedulePolicy"}, + "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, } def __init__( @@ -16124,8 +17337,8 @@ def __init__( *, protected_items_count: Optional[int] = None, resource_guard_operation_requests: Optional[List[str]] = None, - schedule_policy: Optional["SchedulePolicy"] = None, - retention_policy: Optional["RetentionPolicy"] = None, + schedule_policy: Optional["_models.SchedulePolicy"] = None, + retention_policy: Optional["_models.RetentionPolicy"] = None, **kwargs ): """ @@ -16140,17 +17353,21 @@ def __init__( :paramtype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy """ - super(MabProtectionPolicy, self).__init__(protected_items_count=protected_items_count, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.backup_management_type = 'MAB' # type: str + super().__init__( + protected_items_count=protected_items_count, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.backup_management_type = "MAB" # type: str self.schedule_policy = schedule_policy self.retention_policy = retention_policy -class MonthlyRetentionSchedule(msrest.serialization.Model): +class MonthlyRetentionSchedule(_serialization.Model): """Monthly retention schedule. :ivar retention_schedule_format_type: Retention schedule format type for monthly retention - policy. Possible values include: "Invalid", "Daily", "Weekly". + policy. Known values are: "Invalid", "Daily", and "Weekly". :vartype retention_schedule_format_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionScheduleFormat :ivar retention_schedule_daily: Daily retention format for monthly retention policy. @@ -16167,26 +17384,26 @@ class MonthlyRetentionSchedule(msrest.serialization.Model): """ _attribute_map = { - 'retention_schedule_format_type': {'key': 'retentionScheduleFormatType', 'type': 'str'}, - 'retention_schedule_daily': {'key': 'retentionScheduleDaily', 'type': 'DailyRetentionFormat'}, - 'retention_schedule_weekly': {'key': 'retentionScheduleWeekly', 'type': 'WeeklyRetentionFormat'}, - 'retention_times': {'key': 'retentionTimes', 'type': '[iso-8601]'}, - 'retention_duration': {'key': 'retentionDuration', 'type': 'RetentionDuration'}, + "retention_schedule_format_type": {"key": "retentionScheduleFormatType", "type": "str"}, + "retention_schedule_daily": {"key": "retentionScheduleDaily", "type": "DailyRetentionFormat"}, + "retention_schedule_weekly": {"key": "retentionScheduleWeekly", "type": "WeeklyRetentionFormat"}, + "retention_times": {"key": "retentionTimes", "type": "[iso-8601]"}, + "retention_duration": {"key": "retentionDuration", "type": "RetentionDuration"}, } def __init__( self, *, - retention_schedule_format_type: Optional[Union[str, "RetentionScheduleFormat"]] = None, - retention_schedule_daily: Optional["DailyRetentionFormat"] = None, - retention_schedule_weekly: Optional["WeeklyRetentionFormat"] = None, + retention_schedule_format_type: Optional[Union[str, "_models.RetentionScheduleFormat"]] = None, + retention_schedule_daily: Optional["_models.DailyRetentionFormat"] = None, + retention_schedule_weekly: Optional["_models.WeeklyRetentionFormat"] = None, retention_times: Optional[List[datetime.datetime]] = None, - retention_duration: Optional["RetentionDuration"] = None, + retention_duration: Optional["_models.RetentionDuration"] = None, **kwargs ): """ :keyword retention_schedule_format_type: Retention schedule format type for monthly retention - policy. Possible values include: "Invalid", "Daily", "Weekly". + policy. Known values are: "Invalid", "Daily", and "Weekly". :paramtype retention_schedule_format_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionScheduleFormat :keyword retention_schedule_daily: Daily retention format for monthly retention policy. @@ -16201,7 +17418,7 @@ def __init__( :paramtype retention_duration: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDuration """ - super(MonthlyRetentionSchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.retention_schedule_format_type = retention_schedule_format_type self.retention_schedule_daily = retention_schedule_daily self.retention_schedule_weekly = retention_schedule_weekly @@ -16209,54 +17426,54 @@ def __init__( self.retention_duration = retention_duration -class MoveRPAcrossTiersRequest(msrest.serialization.Model): +class MoveRPAcrossTiersRequest(_serialization.Model): """MoveRPAcrossTiersRequest. :ivar object_type: Gets the class type. :vartype object_type: str - :ivar source_tier_type: Source tier from where RP needs to be moved. Possible values include: - "Invalid", "InstantRP", "HardenedRP", "ArchivedRP". + :ivar source_tier_type: Source tier from where RP needs to be moved. Known values are: + "Invalid", "InstantRP", "HardenedRP", and "ArchivedRP". :vartype source_tier_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType - :ivar target_tier_type: Target tier where RP needs to be moved. Possible values include: - "Invalid", "InstantRP", "HardenedRP", "ArchivedRP". + :ivar target_tier_type: Target tier where RP needs to be moved. Known values are: "Invalid", + "InstantRP", "HardenedRP", and "ArchivedRP". :vartype target_tier_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType """ _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'source_tier_type': {'key': 'sourceTierType', 'type': 'str'}, - 'target_tier_type': {'key': 'targetTierType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "source_tier_type": {"key": "sourceTierType", "type": "str"}, + "target_tier_type": {"key": "targetTierType", "type": "str"}, } def __init__( self, *, object_type: Optional[str] = None, - source_tier_type: Optional[Union[str, "RecoveryPointTierType"]] = None, - target_tier_type: Optional[Union[str, "RecoveryPointTierType"]] = None, + source_tier_type: Optional[Union[str, "_models.RecoveryPointTierType"]] = None, + target_tier_type: Optional[Union[str, "_models.RecoveryPointTierType"]] = None, **kwargs ): """ :keyword object_type: Gets the class type. :paramtype object_type: str - :keyword source_tier_type: Source tier from where RP needs to be moved. Possible values - include: "Invalid", "InstantRP", "HardenedRP", "ArchivedRP". + :keyword source_tier_type: Source tier from where RP needs to be moved. Known values are: + "Invalid", "InstantRP", "HardenedRP", and "ArchivedRP". :paramtype source_tier_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType - :keyword target_tier_type: Target tier where RP needs to be moved. Possible values include: - "Invalid", "InstantRP", "HardenedRP", "ArchivedRP". + :keyword target_tier_type: Target tier where RP needs to be moved. Known values are: "Invalid", + "InstantRP", "HardenedRP", and "ArchivedRP". :paramtype target_tier_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType """ - super(MoveRPAcrossTiersRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.object_type = object_type self.source_tier_type = source_tier_type self.target_tier_type = target_tier_type -class NameInfo(msrest.serialization.Model): +class NameInfo(_serialization.Model): """The name of usage. :ivar value: Value of usage. @@ -16266,29 +17483,23 @@ class NameInfo(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__( - self, - *, - value: Optional[str] = None, - localized_value: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): """ :keyword value: Value of usage. :paramtype value: str :keyword localized_value: Localized value of usage. :paramtype localized_value: str """ - super(NameInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.localized_value = localized_value -class NewErrorResponse(msrest.serialization.Model): +class NewErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -16296,24 +17507,19 @@ class NewErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'NewErrorResponseError'}, + "error": {"key": "error", "type": "NewErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["NewErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.NewErrorResponseError"] = None, **kwargs): """ :keyword error: The error object. :paramtype error: ~azure.mgmt.recoveryservicesbackup.activestamp.models.NewErrorResponseError """ - super(NewErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class NewErrorResponseError(msrest.serialization.Model): +class NewErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -16332,28 +17538,24 @@ class NewErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[NewErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[NewErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(NewErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -16366,41 +17568,36 @@ class OperationResultInfo(OperationResultInfoBase): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar job_list: List of jobs created by this operation. :vartype job_list: list[str] """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'job_list': {'key': 'jobList', 'type': '[str]'}, + "object_type": {"key": "objectType", "type": "str"}, + "job_list": {"key": "jobList", "type": "[str]"}, } - def __init__( - self, - *, - job_list: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, job_list: Optional[List[str]] = None, **kwargs): """ :keyword job_list: List of jobs created by this operation. :paramtype job_list: list[str] """ - super(OperationResultInfo, self).__init__(**kwargs) - self.object_type = 'OperationResultInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationResultInfo" # type: str self.job_list = job_list -class OperationWorkerResponse(msrest.serialization.Model): +class OperationWorkerResponse(_serialization.Model): """This is the base class for operation result responses. - :ivar status_code: HTTP Status Code of the operation. Possible values include: "Continue", + :ivar status_code: HTTP Status Code of the operation. Known values are: "Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", @@ -16409,7 +17606,7 @@ class OperationWorkerResponse(msrest.serialization.Model): "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", - "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", and "HttpVersionNotSupported". :vartype status_code: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HttpStatusCode @@ -16418,19 +17615,19 @@ class OperationWorkerResponse(msrest.serialization.Model): """ _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{[str]}'}, + "status_code": {"key": "statusCode", "type": "str"}, + "headers": {"key": "headers", "type": "{[str]}"}, } def __init__( self, *, - status_code: Optional[Union[str, "HttpStatusCode"]] = None, + status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, headers: Optional[Dict[str, List[str]]] = None, **kwargs ): """ - :keyword status_code: HTTP Status Code of the operation. Possible values include: "Continue", + :keyword status_code: HTTP Status Code of the operation. Known values are: "Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", @@ -16439,14 +17636,14 @@ def __init__( "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", - "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", and "HttpVersionNotSupported". :paramtype status_code: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HttpStatusCode :keyword headers: HTTP headers associated with this operation. :paramtype headers: dict[str, list[str]] """ - super(OperationWorkerResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.status_code = status_code self.headers = headers @@ -16454,7 +17651,7 @@ def __init__( class OperationResultInfoBaseResource(OperationWorkerResponse): """Base class for operation result info. - :ivar status_code: HTTP Status Code of the operation. Possible values include: "Continue", + :ivar status_code: HTTP Status Code of the operation. Known values are: "Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", @@ -16463,7 +17660,7 @@ class OperationResultInfoBaseResource(OperationWorkerResponse): "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", - "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", and "HttpVersionNotSupported". :vartype status_code: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HttpStatusCode @@ -16475,21 +17672,21 @@ class OperationResultInfoBaseResource(OperationWorkerResponse): """ _attribute_map = { - 'status_code': {'key': 'statusCode', 'type': 'str'}, - 'headers': {'key': 'headers', 'type': '{[str]}'}, - 'operation': {'key': 'operation', 'type': 'OperationResultInfoBase'}, + "status_code": {"key": "statusCode", "type": "str"}, + "headers": {"key": "headers", "type": "{[str]}"}, + "operation": {"key": "operation", "type": "OperationResultInfoBase"}, } def __init__( self, *, - status_code: Optional[Union[str, "HttpStatusCode"]] = None, + status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, headers: Optional[Dict[str, List[str]]] = None, - operation: Optional["OperationResultInfoBase"] = None, + operation: Optional["_models.OperationResultInfoBase"] = None, **kwargs ): """ - :keyword status_code: HTTP Status Code of the operation. Possible values include: "Continue", + :keyword status_code: HTTP Status Code of the operation. Known values are: "Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", @@ -16498,7 +17695,7 @@ def __init__( "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", - "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", + "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", and "HttpVersionNotSupported". :paramtype status_code: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HttpStatusCode @@ -16508,19 +17705,19 @@ def __init__( :paramtype operation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationResultInfoBase """ - super(OperationResultInfoBaseResource, self).__init__(status_code=status_code, headers=headers, **kwargs) + super().__init__(status_code=status_code, headers=headers, **kwargs) self.operation = operation -class OperationStatus(msrest.serialization.Model): +class OperationStatus(_serialization.Model): """Operation status. :ivar id: ID of the operation. :vartype id: str :ivar name: Name of the operation. :vartype name: str - :ivar status: Operation status. Possible values include: "Invalid", "InProgress", "Succeeded", - "Failed", "Canceled". + :ivar status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", + "Failed", and "Canceled". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatusValues :ivar start_time: Operation start time. Format: ISO-8601. @@ -16535,25 +17732,25 @@ class OperationStatus(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'OperationStatusError'}, - 'properties': {'key': 'properties', 'type': 'OperationStatusExtendedInfo'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "error": {"key": "error", "type": "OperationStatusError"}, + "properties": {"key": "properties", "type": "OperationStatusExtendedInfo"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, - status: Optional[Union[str, "OperationStatusValues"]] = None, + status: Optional[Union[str, "_models.OperationStatusValues"]] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - error: Optional["OperationStatusError"] = None, - properties: Optional["OperationStatusExtendedInfo"] = None, + error: Optional["_models.OperationStatusError"] = None, + properties: Optional["_models.OperationStatusExtendedInfo"] = None, **kwargs ): """ @@ -16561,8 +17758,8 @@ def __init__( :paramtype id: str :keyword name: Name of the operation. :paramtype name: str - :keyword status: Operation status. Possible values include: "Invalid", "InProgress", - "Succeeded", "Failed", "Canceled". + :keyword status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", + "Failed", and "Canceled". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatusValues :keyword start_time: Operation start time. Format: ISO-8601. @@ -16575,7 +17772,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatusExtendedInfo """ - super(OperationStatus, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.status = status @@ -16585,7 +17782,7 @@ def __init__( self.properties = properties -class OperationStatusError(msrest.serialization.Model): +class OperationStatusError(_serialization.Model): """Error information associated with operation status call. :ivar code: Error code of the operation failure. @@ -16595,60 +17792,56 @@ class OperationStatusError(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, } - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): """ :keyword code: Error code of the operation failure. :paramtype code: str :keyword message: Error message displayed if the operation failure. :paramtype message: str """ - super(OperationStatusError, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message -class OperationStatusExtendedInfo(msrest.serialization.Model): +class OperationStatusExtendedInfo(_serialization.Model): """Base class for additional information of operation status. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OperationStatusJobExtendedInfo, OperationStatusJobsExtendedInfo, OperationStatusProvisionILRExtendedInfo, OperationStatusValidateOperationExtendedInfo. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OperationStatusJobExtendedInfo, OperationStatusJobsExtendedInfo, + OperationStatusProvisionILRExtendedInfo, OperationStatusValidateOperationExtendedInfo All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'OperationStatusJobExtendedInfo': 'OperationStatusJobExtendedInfo', 'OperationStatusJobsExtendedInfo': 'OperationStatusJobsExtendedInfo', 'OperationStatusProvisionILRExtendedInfo': 'OperationStatusProvisionILRExtendedInfo', 'OperationStatusValidateOperationExtendedInfo': 'OperationStatusValidateOperationExtendedInfo'} + "object_type": { + "OperationStatusJobExtendedInfo": "OperationStatusJobExtendedInfo", + "OperationStatusJobsExtendedInfo": "OperationStatusJobsExtendedInfo", + "OperationStatusProvisionILRExtendedInfo": "OperationStatusProvisionILRExtendedInfo", + "OperationStatusValidateOperationExtendedInfo": "OperationStatusValidateOperationExtendedInfo", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationStatusExtendedInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -16657,34 +17850,29 @@ class OperationStatusJobExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar job_id: ID of the job created for this protected item. :vartype job_id: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, } - def __init__( - self, - *, - job_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, job_id: Optional[str] = None, **kwargs): """ :keyword job_id: ID of the job created for this protected item. :paramtype job_id: str """ - super(OperationStatusJobExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusJobExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusJobExtendedInfo" # type: str self.job_id = job_id @@ -16693,8 +17881,8 @@ class OperationStatusJobsExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar job_ids: IDs of the jobs created for the protected item. :vartype job_ids: list[str] @@ -16703,21 +17891,17 @@ class OperationStatusJobsExtendedInfo(OperationStatusExtendedInfo): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'job_ids': {'key': 'jobIds', 'type': '[str]'}, - 'failed_jobs_error': {'key': 'failedJobsError', 'type': '{str}'}, + "object_type": {"key": "objectType", "type": "str"}, + "job_ids": {"key": "jobIds", "type": "[str]"}, + "failed_jobs_error": {"key": "failedJobsError", "type": "{str}"}, } def __init__( - self, - *, - job_ids: Optional[List[str]] = None, - failed_jobs_error: Optional[Dict[str, str]] = None, - **kwargs + self, *, job_ids: Optional[List[str]] = None, failed_jobs_error: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword job_ids: IDs of the jobs created for the protected item. @@ -16726,8 +17910,8 @@ def __init__( codes. :paramtype failed_jobs_error: dict[str, str] """ - super(OperationStatusJobsExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusJobsExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusJobsExtendedInfo" # type: str self.job_ids = job_ids self.failed_jobs_error = failed_jobs_error @@ -16737,8 +17921,8 @@ class OperationStatusProvisionILRExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_target: Target details for file / folder restore. :vartype recovery_target: @@ -16746,27 +17930,22 @@ class OperationStatusProvisionILRExtendedInfo(OperationStatusExtendedInfo): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_target': {'key': 'recoveryTarget', 'type': 'InstantItemRecoveryTarget'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_target": {"key": "recoveryTarget", "type": "InstantItemRecoveryTarget"}, } - def __init__( - self, - *, - recovery_target: Optional["InstantItemRecoveryTarget"] = None, - **kwargs - ): + def __init__(self, *, recovery_target: Optional["_models.InstantItemRecoveryTarget"] = None, **kwargs): """ :keyword recovery_target: Target details for file / folder restore. :paramtype recovery_target: ~azure.mgmt.recoveryservicesbackup.activestamp.models.InstantItemRecoveryTarget """ - super(OperationStatusProvisionILRExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusProvisionILRExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusProvisionILRExtendedInfo" # type: str self.recovery_target = recovery_target @@ -16775,8 +17954,8 @@ class OperationStatusValidateOperationExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar validate_operation_response: Gets the validation operation response. :vartype validate_operation_response: @@ -16784,31 +17963,26 @@ class OperationStatusValidateOperationExtendedInfo(OperationStatusExtendedInfo): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'validate_operation_response': {'key': 'validateOperationResponse', 'type': 'ValidateOperationResponse'}, + "object_type": {"key": "objectType", "type": "str"}, + "validate_operation_response": {"key": "validateOperationResponse", "type": "ValidateOperationResponse"}, } - def __init__( - self, - *, - validate_operation_response: Optional["ValidateOperationResponse"] = None, - **kwargs - ): + def __init__(self, *, validate_operation_response: Optional["_models.ValidateOperationResponse"] = None, **kwargs): """ :keyword validate_operation_response: Gets the validation operation response. :paramtype validate_operation_response: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationResponse """ - super(OperationStatusValidateOperationExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusValidateOperationExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusValidateOperationExtendedInfo" # type: str self.validate_operation_response = validate_operation_response -class PointInTimeRange(msrest.serialization.Model): +class PointInTimeRange(_serialization.Model): """Provides details for log ranges. :ivar start_time: Start time of the time range for log recovery. @@ -16818,16 +17992,12 @@ class PointInTimeRange(msrest.serialization.Model): """ _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, } def __init__( - self, - *, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - **kwargs + self, *, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, **kwargs ): """ :keyword start_time: Start time of the time range for log recovery. @@ -16835,16 +18005,16 @@ def __init__( :keyword end_time: End time of the time range for log recovery. :paramtype end_time: ~datetime.datetime """ - super(PointInTimeRange, self).__init__(**kwargs) + super().__init__(**kwargs) self.start_time = start_time self.end_time = end_time -class PreBackupValidation(msrest.serialization.Model): +class PreBackupValidation(_serialization.Model): """Pre-backup validation for Azure VM Workload provider. - :ivar status: Status of protectable item, i.e. InProgress,Succeeded,Failed. Possible values - include: "Invalid", "Success", "Failed". + :ivar status: Status of protectable item, i.e. InProgress,Succeeded,Failed. Known values are: + "Invalid", "Success", and "Failed". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InquiryStatus :ivar code: Error code of protectable item. :vartype code: str @@ -16853,44 +18023,44 @@ class PreBackupValidation(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, } def __init__( self, *, - status: Optional[Union[str, "InquiryStatus"]] = None, + status: Optional[Union[str, "_models.InquiryStatus"]] = None, code: Optional[str] = None, message: Optional[str] = None, **kwargs ): """ - :keyword status: Status of protectable item, i.e. InProgress,Succeeded,Failed. Possible values - include: "Invalid", "Success", "Failed". + :keyword status: Status of protectable item, i.e. InProgress,Succeeded,Failed. Known values + are: "Invalid", "Success", and "Failed". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InquiryStatus :keyword code: Error code of protectable item. :paramtype code: str :keyword message: Message corresponding to the error code for the protectable item. :paramtype message: str """ - super(PreBackupValidation, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.code = code self.message = message -class PrepareDataMoveRequest(msrest.serialization.Model): +class PrepareDataMoveRequest(_serialization.Model): """Prepare DataMove Request. All required parameters must be populated in order to send to Azure. - :ivar target_resource_id: Required. ARM Id of target vault. + :ivar target_resource_id: ARM Id of target vault. Required. :vartype target_resource_id: str - :ivar target_region: Required. Target Region. + :ivar target_region: Target Region. Required. :vartype target_region: str - :ivar data_move_level: Required. DataMove Level. Possible values include: "Invalid", "Vault", + :ivar data_move_level: DataMove Level. Required. Known values are: "Invalid", "Vault", and "Container". :vartype data_move_level: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataMoveLevel @@ -16902,17 +18072,17 @@ class PrepareDataMoveRequest(msrest.serialization.Model): """ _validation = { - 'target_resource_id': {'required': True}, - 'target_region': {'required': True}, - 'data_move_level': {'required': True}, + "target_resource_id": {"required": True}, + "target_region": {"required": True}, + "data_move_level": {"required": True}, } _attribute_map = { - 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, - 'target_region': {'key': 'targetRegion', 'type': 'str'}, - 'data_move_level': {'key': 'dataMoveLevel', 'type': 'str'}, - 'source_container_arm_ids': {'key': 'sourceContainerArmIds', 'type': '[str]'}, - 'ignore_moved': {'key': 'ignoreMoved', 'type': 'bool'}, + "target_resource_id": {"key": "targetResourceId", "type": "str"}, + "target_region": {"key": "targetRegion", "type": "str"}, + "data_move_level": {"key": "dataMoveLevel", "type": "str"}, + "source_container_arm_ids": {"key": "sourceContainerArmIds", "type": "[str]"}, + "ignore_moved": {"key": "ignoreMoved", "type": "bool"}, } def __init__( @@ -16920,18 +18090,18 @@ def __init__( *, target_resource_id: str, target_region: str, - data_move_level: Union[str, "DataMoveLevel"], + data_move_level: Union[str, "_models.DataMoveLevel"], source_container_arm_ids: Optional[List[str]] = None, ignore_moved: Optional[bool] = None, **kwargs ): """ - :keyword target_resource_id: Required. ARM Id of target vault. + :keyword target_resource_id: ARM Id of target vault. Required. :paramtype target_resource_id: str - :keyword target_region: Required. Target Region. + :keyword target_region: Target Region. Required. :paramtype target_region: str - :keyword data_move_level: Required. DataMove Level. Possible values include: "Invalid", - "Vault", "Container". + :keyword data_move_level: DataMove Level. Required. Known values are: "Invalid", "Vault", and + "Container". :paramtype data_move_level: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataMoveLevel :keyword source_container_arm_ids: Source Container ArmIds @@ -16940,7 +18110,7 @@ def __init__( :keyword ignore_moved: Ignore the artifacts which are already moved. :paramtype ignore_moved: bool """ - super(PrepareDataMoveRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.target_resource_id = target_resource_id self.target_region = target_region self.data_move_level = data_move_level @@ -16948,38 +18118,32 @@ def __init__( self.ignore_moved = ignore_moved -class VaultStorageConfigOperationResultResponse(msrest.serialization.Model): +class VaultStorageConfigOperationResultResponse(_serialization.Model): """Operation result response for Vault Storage Config. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: PrepareDataMoveResponse. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + PrepareDataMoveResponse All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } - _subtype_map = { - 'object_type': {'PrepareDataMoveResponse': 'PrepareDataMoveResponse'} - } + _subtype_map = {"object_type": {"PrepareDataMoveResponse": "PrepareDataMoveResponse"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(VaultStorageConfigOperationResultResponse, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -16988,8 +18152,8 @@ class PrepareDataMoveResponse(VaultStorageConfigOperationResultResponse): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar correlation_id: Co-relationId for move operation. :vartype correlation_id: str @@ -16998,13 +18162,13 @@ class PrepareDataMoveResponse(VaultStorageConfigOperationResultResponse): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'source_vault_properties': {'key': 'sourceVaultProperties', 'type': '{str}'}, + "object_type": {"key": "objectType", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "source_vault_properties": {"key": "sourceVaultProperties", "type": "{str}"}, } def __init__( @@ -17020,56 +18184,56 @@ def __init__( :keyword source_vault_properties: Source Vault Properties. :paramtype source_vault_properties: dict[str, str] """ - super(PrepareDataMoveResponse, self).__init__(**kwargs) - self.object_type = 'PrepareDataMoveResponse' # type: str + super().__init__(**kwargs) + self.object_type = "PrepareDataMoveResponse" # type: str self.correlation_id = correlation_id self.source_vault_properties = source_vault_properties -class PreValidateEnableBackupRequest(msrest.serialization.Model): +class PreValidateEnableBackupRequest(_serialization.Model): """Contract to validate if backup can be enabled on the given resource in a given vault and given configuration. -It will validate followings + It will validate followings -#. Vault capacity -#. VM is already protected -#. Any VM related configuration passed in properties. + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. - :ivar resource_type: ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc. Possible values - include: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", - "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". - :vartype resource_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType - :ivar resource_id: ARM Virtual Machine Id. - :vartype resource_id: str - :ivar vault_id: ARM id of the Recovery Services Vault. - :vartype vault_id: str - :ivar properties: Configuration of VM if any needs to be validated like OS type etc. - :vartype properties: str + :ivar resource_type: ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc. Known values are: + "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", + "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". + :vartype resource_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType + :ivar resource_id: ARM Virtual Machine Id. + :vartype resource_id: str + :ivar vault_id: ARM id of the Recovery Services Vault. + :vartype vault_id: str + :ivar properties: Configuration of VM if any needs to be validated like OS type etc. + :vartype properties: str """ _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'str'}, + "resource_type": {"key": "resourceType", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "vault_id": {"key": "vaultId", "type": "str"}, + "properties": {"key": "properties", "type": "str"}, } def __init__( self, *, - resource_type: Optional[Union[str, "DataSourceType"]] = None, + resource_type: Optional[Union[str, "_models.DataSourceType"]] = None, resource_id: Optional[str] = None, vault_id: Optional[str] = None, properties: Optional[str] = None, **kwargs ): """ - :keyword resource_type: ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc. Possible - values include: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", + :keyword resource_type: ProtectedItem Type- VM, SqlDataBase, AzureFileShare etc. Known values + are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype resource_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword resource_id: ARM Virtual Machine Id. @@ -17079,17 +18243,17 @@ def __init__( :keyword properties: Configuration of VM if any needs to be validated like OS type etc. :paramtype properties: str """ - super(PreValidateEnableBackupRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_type = resource_type self.resource_id = resource_id self.vault_id = vault_id self.properties = properties -class PreValidateEnableBackupResponse(msrest.serialization.Model): +class PreValidateEnableBackupResponse(_serialization.Model): """Response contract for enable backup validation request. - :ivar status: Validation Status. Possible values include: "Invalid", "Succeeded", "Failed". + :ivar status: Validation Status. Known values are: "Invalid", "Succeeded", and "Failed". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidationStatus :ivar error_code: Response error code. :vartype error_code: str @@ -17107,18 +18271,18 @@ class PreValidateEnableBackupResponse(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'recommendation': {'key': 'recommendation', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'protected_item_name': {'key': 'protectedItemName', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "error_code": {"key": "errorCode", "type": "str"}, + "error_message": {"key": "errorMessage", "type": "str"}, + "recommendation": {"key": "recommendation", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "protected_item_name": {"key": "protectedItemName", "type": "str"}, } def __init__( self, *, - status: Optional[Union[str, "ValidationStatus"]] = None, + status: Optional[Union[str, "_models.ValidationStatus"]] = None, error_code: Optional[str] = None, error_message: Optional[str] = None, recommendation: Optional[str] = None, @@ -17127,7 +18291,7 @@ def __init__( **kwargs ): """ - :keyword status: Validation Status. Possible values include: "Invalid", "Succeeded", "Failed". + :keyword status: Validation Status. Known values are: "Invalid", "Succeeded", and "Failed". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidationStatus :keyword error_code: Response error code. @@ -17144,7 +18308,7 @@ def __init__( vm;iaasvmcontainer;rgname;vmname. This is required for portal. :paramtype protected_item_name: str """ - super(PreValidateEnableBackupResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.error_code = error_code self.error_message = error_message @@ -17153,7 +18317,7 @@ def __init__( self.protected_item_name = protected_item_name -class PrivateEndpoint(msrest.serialization.Model): +class PrivateEndpoint(_serialization.Model): """The Private Endpoint network resource that is linked to the Private Endpoint connection. :ivar id: Gets or sets id. @@ -17161,28 +18325,23 @@ class PrivateEndpoint(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: Gets or sets id. :paramtype id: str """ - super(PrivateEndpoint, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id -class PrivateEndpointConnection(msrest.serialization.Model): +class PrivateEndpointConnection(_serialization.Model): """Private Endpoint Connection Response Properties. :ivar provisioning_state: Gets or sets provisioning state of the private endpoint connection. - Possible values include: "Succeeded", "Deleting", "Failed", "Pending". + Known values are: "Succeeded", "Deleting", "Failed", and "Pending". :vartype provisioning_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProvisioningState :ivar private_endpoint: Gets or sets private endpoint associated with the private endpoint @@ -17196,22 +18355,25 @@ class PrivateEndpointConnection(msrest.serialization.Model): """ _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "private_endpoint": {"key": "privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, } def __init__( self, *, - provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ :keyword provisioning_state: Gets or sets provisioning state of the private endpoint - connection. Possible values include: "Succeeded", "Deleting", "Failed", "Pending". + connection. Known values are: "Succeeded", "Deleting", "Failed", and "Pending". :paramtype provisioning_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProvisioningState :keyword private_endpoint: Gets or sets private endpoint associated with the private endpoint @@ -17223,7 +18385,7 @@ def __init__( :paramtype private_link_service_connection_state: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateLinkServiceConnectionState """ - super(PrivateEndpointConnection, self).__init__(**kwargs) + super().__init__(**kwargs) self.provisioning_state = provisioning_state self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -17243,7 +18405,7 @@ class PrivateEndpointConnectionResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -17253,19 +18415,19 @@ class PrivateEndpointConnectionResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnection'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "PrivateEndpointConnection"}, } def __init__( @@ -17274,13 +18436,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["PrivateEndpointConnection"] = None, + properties: Optional["_models.PrivateEndpointConnection"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -17288,15 +18450,15 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnection """ - super(PrivateEndpointConnectionResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class PrivateLinkServiceConnectionState(msrest.serialization.Model): +class PrivateLinkServiceConnectionState(_serialization.Model): """Private Link Service Connection State. - :ivar status: Gets or sets the status. Possible values include: "Pending", "Approved", - "Rejected", "Disconnected". + :ivar status: Gets or sets the status. Known values are: "Pending", "Approved", "Rejected", and + "Disconnected". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionStatus :ivar description: Gets or sets description. @@ -17306,22 +18468,22 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "action_required": {"key": "actionRequired", "type": "str"}, } def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointConnectionStatus"]] = None, description: Optional[str] = None, action_required: Optional[str] = None, **kwargs ): """ - :keyword status: Gets or sets the status. Possible values include: "Pending", "Approved", - "Rejected", "Disconnected". + :keyword status: Gets or sets the status. Known values are: "Pending", "Approved", "Rejected", + and "Disconnected". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionStatus :keyword description: Gets or sets description. @@ -17329,7 +18491,7 @@ def __init__( :keyword action_required: Gets or sets actions required. :paramtype action_required: str """ - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.description = description self.action_required = action_required @@ -17349,7 +18511,7 @@ class ProtectableContainerResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -17358,19 +18520,19 @@ class ProtectableContainerResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectableContainer'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectableContainer"}, } def __init__( @@ -17379,13 +18541,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ProtectableContainer"] = None, + properties: Optional["_models.ProtectableContainer"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -17393,7 +18555,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainer """ - super(ProtectableContainerResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -17409,15 +18571,15 @@ class ProtectableContainerResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ProtectableContainerResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ProtectableContainerResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ProtectableContainerResource"]] = None, + value: Optional[List["_models.ProtectableContainerResource"]] = None, **kwargs ): """ @@ -17428,25 +18590,25 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResource] """ - super(ProtectableContainerResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class ProtectedItemQueryObject(msrest.serialization.Model): +class ProtectedItemQueryObject(_serialization.Model): """Filters to list backup items. - :ivar health_state: Health State for the backed up item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_state: Health State for the backed up item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthState - :ivar backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for the backed up item. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar item_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar item_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar policy_name: Backup policy name associated with the backup item. :vartype policy_name: str @@ -17463,23 +18625,23 @@ class ProtectedItemQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'health_state': {'key': 'healthState', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'item_type': {'key': 'itemType', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'backup_engine_name': {'key': 'backupEngineName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, + "health_state": {"key": "healthState", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "item_type": {"key": "itemType", "type": "str"}, + "policy_name": {"key": "policyName", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "backup_engine_name": {"key": "backupEngineName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, } def __init__( self, *, - health_state: Optional[Union[str, "HealthState"]] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - item_type: Optional[Union[str, "DataSourceType"]] = None, + health_state: Optional[Union[str, "_models.HealthState"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + item_type: Optional[Union[str, "_models.DataSourceType"]] = None, policy_name: Optional[str] = None, container_name: Optional[str] = None, backup_engine_name: Optional[str] = None, @@ -17489,19 +18651,19 @@ def __init__( **kwargs ): """ - :keyword health_state: Health State for the backed up item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :keyword health_state: Health State for the backed up item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthState - :keyword backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword item_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :keyword item_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword policy_name: Backup policy name associated with the backup item. @@ -17517,7 +18679,7 @@ def __init__( :keyword backup_set_name: Name of the backup set. :paramtype backup_set_name: str """ - super(ProtectedItemQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.health_state = health_state self.backup_management_type = backup_management_type self.item_type = item_type @@ -17543,7 +18705,7 @@ class ProtectedItemResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -17552,19 +18714,19 @@ class ProtectedItemResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectedItem'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectedItem"}, } def __init__( @@ -17573,20 +18735,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ProtectedItem"] = None, + properties: Optional["_models.ProtectedItem"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: ProtectedItemResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItem """ - super(ProtectedItemResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -17602,15 +18764,15 @@ class ProtectedItemResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ProtectedItemResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ProtectedItemResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ProtectedItemResource"]] = None, + value: Optional[List["_models.ProtectedItemResource"]] = None, **kwargs ): """ @@ -17621,7 +18783,7 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource] """ - super(ProtectedItemResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value @@ -17639,7 +18801,7 @@ class ProtectionContainerResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -17648,19 +18810,19 @@ class ProtectionContainerResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionContainer'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectionContainer"}, } def __init__( @@ -17669,13 +18831,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ProtectionContainer"] = None, + properties: Optional["_models.ProtectionContainer"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -17683,7 +18845,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainer """ - super(ProtectionContainerResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -17699,15 +18861,15 @@ class ProtectionContainerResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ProtectionContainerResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ProtectionContainerResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ProtectionContainerResource"]] = None, + value: Optional[List["_models.ProtectionContainerResource"]] = None, **kwargs ): """ @@ -17718,20 +18880,20 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource] """ - super(ProtectionContainerResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class ProtectionIntentQueryObject(msrest.serialization.Model): +class ProtectionIntentQueryObject(_serialization.Model): """Filters to list protection intent. - :ivar backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for the backed up item. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :ivar item_type: Type of workload this item represents. Possible values include: "Invalid", - "SQLInstance", "SQLAvailabilityGroupContainer". + :ivar item_type: Type of workload this item represents. Known values are: "Invalid", + "SQLInstance", and "SQLAvailabilityGroupContainer". :vartype item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.IntentItemType :ivar parent_name: Parent name of the intent. :vartype parent_name: str @@ -17740,29 +18902,29 @@ class ProtectionIntentQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'item_type': {'key': 'itemType', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'item_name': {'key': 'itemName', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "item_type": {"key": "itemType", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "item_name": {"key": "itemName", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - item_type: Optional[Union[str, "IntentItemType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + item_type: Optional[Union[str, "_models.IntentItemType"]] = None, parent_name: Optional[str] = None, item_name: Optional[str] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType - :keyword item_type: Type of workload this item represents. Possible values include: "Invalid", - "SQLInstance", "SQLAvailabilityGroupContainer". + :keyword item_type: Type of workload this item represents. Known values are: "Invalid", + "SQLInstance", and "SQLAvailabilityGroupContainer". :paramtype item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.IntentItemType :keyword parent_name: Parent name of the intent. @@ -17770,7 +18932,7 @@ def __init__( :keyword item_name: Item name of the intent. :paramtype item_name: str """ - super(ProtectionIntentQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.item_type = item_type self.parent_name = parent_name @@ -17791,7 +18953,7 @@ class ProtectionIntentResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -17800,19 +18962,19 @@ class ProtectionIntentResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionIntent'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectionIntent"}, } def __init__( @@ -17821,20 +18983,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ProtectionIntent"] = None, + properties: Optional["_models.ProtectionIntent"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: ProtectionIntentResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntent """ - super(ProtectionIntentResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -17850,15 +19012,15 @@ class ProtectionIntentResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ProtectionIntentResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ProtectionIntentResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ProtectionIntentResource"]] = None, + value: Optional[List["_models.ProtectionIntentResource"]] = None, **kwargs ): """ @@ -17869,58 +19031,58 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource] """ - super(ProtectionIntentResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class ProtectionPolicyQueryObject(msrest.serialization.Model): +class ProtectionPolicyQueryObject(_serialization.Model): """Filters the list backup policies API. - :ivar backup_management_type: Backup management type for the backup policy. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for the backup policy. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar fabric_name: Fabric name for filter. :vartype fabric_name: str - :ivar workload_type: Workload type for the backup policy. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + :ivar workload_type: Workload type for the backup policy. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, fabric_name: Optional[str] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type for the backup policy. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for the backup policy. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword fabric_name: Fabric name for filter. :paramtype fabric_name: str - :keyword workload_type: Workload type for the backup policy. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Workload type for the backup policy. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType """ - super(ProtectionPolicyQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type self.fabric_name = fabric_name self.workload_type = workload_type @@ -17940,7 +19102,7 @@ class ProtectionPolicyResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -17949,19 +19111,19 @@ class ProtectionPolicyResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectionPolicy'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectionPolicy"}, } def __init__( @@ -17970,20 +19132,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ProtectionPolicy"] = None, + properties: Optional["_models.ProtectionPolicy"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: ProtectionPolicyResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicy """ - super(ProtectionPolicyResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -17999,15 +19161,15 @@ class ProtectionPolicyResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ProtectionPolicyResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ProtectionPolicyResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ProtectionPolicyResource"]] = None, + value: Optional[List["_models.ProtectionPolicyResource"]] = None, **kwargs ): """ @@ -18018,11 +19180,11 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource] """ - super(ProtectionPolicyResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class RecoveryPointDiskConfiguration(msrest.serialization.Model): +class RecoveryPointDiskConfiguration(_serialization.Model): """Disk configuration. :ivar number_of_disks_included_in_backup: Number of disks included in backup. @@ -18038,10 +19200,10 @@ class RecoveryPointDiskConfiguration(msrest.serialization.Model): """ _attribute_map = { - 'number_of_disks_included_in_backup': {'key': 'numberOfDisksIncludedInBackup', 'type': 'int'}, - 'number_of_disks_attached_to_vm': {'key': 'numberOfDisksAttachedToVm', 'type': 'int'}, - 'included_disk_list': {'key': 'includedDiskList', 'type': '[DiskInformation]'}, - 'excluded_disk_list': {'key': 'excludedDiskList', 'type': '[DiskInformation]'}, + "number_of_disks_included_in_backup": {"key": "numberOfDisksIncludedInBackup", "type": "int"}, + "number_of_disks_attached_to_vm": {"key": "numberOfDisksAttachedToVm", "type": "int"}, + "included_disk_list": {"key": "includedDiskList", "type": "[DiskInformation]"}, + "excluded_disk_list": {"key": "excludedDiskList", "type": "[DiskInformation]"}, } def __init__( @@ -18049,8 +19211,8 @@ def __init__( *, number_of_disks_included_in_backup: Optional[int] = None, number_of_disks_attached_to_vm: Optional[int] = None, - included_disk_list: Optional[List["DiskInformation"]] = None, - excluded_disk_list: Optional[List["DiskInformation"]] = None, + included_disk_list: Optional[List["_models.DiskInformation"]] = None, + excluded_disk_list: Optional[List["_models.DiskInformation"]] = None, **kwargs ): """ @@ -18065,14 +19227,14 @@ def __init__( :paramtype excluded_disk_list: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.DiskInformation] """ - super(RecoveryPointDiskConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.number_of_disks_included_in_backup = number_of_disks_included_in_backup self.number_of_disks_attached_to_vm = number_of_disks_attached_to_vm self.included_disk_list = included_disk_list self.excluded_disk_list = excluded_disk_list -class RecoveryPointMoveReadinessInfo(msrest.serialization.Model): +class RecoveryPointMoveReadinessInfo(_serialization.Model): """RecoveryPointMoveReadinessInfo. :ivar is_ready_for_move: @@ -18082,61 +19244,54 @@ class RecoveryPointMoveReadinessInfo(msrest.serialization.Model): """ _attribute_map = { - 'is_ready_for_move': {'key': 'isReadyForMove', 'type': 'bool'}, - 'additional_info': {'key': 'additionalInfo', 'type': 'str'}, + "is_ready_for_move": {"key": "isReadyForMove", "type": "bool"}, + "additional_info": {"key": "additionalInfo", "type": "str"}, } - def __init__( - self, - *, - is_ready_for_move: Optional[bool] = None, - additional_info: Optional[str] = None, - **kwargs - ): + def __init__(self, *, is_ready_for_move: Optional[bool] = None, additional_info: Optional[str] = None, **kwargs): """ :keyword is_ready_for_move: :paramtype is_ready_for_move: bool :keyword additional_info: :paramtype additional_info: str """ - super(RecoveryPointMoveReadinessInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_ready_for_move = is_ready_for_move self.additional_info = additional_info -class RecoveryPointRehydrationInfo(msrest.serialization.Model): +class RecoveryPointRehydrationInfo(_serialization.Model): """RP Rehydration Info. :ivar rehydration_retention_duration: How long the rehydrated RP should be kept Should be ISO8601 Duration format e.g. "P7D". :vartype rehydration_retention_duration: str - :ivar rehydration_priority: Rehydration Priority. Possible values include: "Standard", "High". + :ivar rehydration_priority: Rehydration Priority. Known values are: "Standard" and "High". :vartype rehydration_priority: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RehydrationPriority """ _attribute_map = { - 'rehydration_retention_duration': {'key': 'rehydrationRetentionDuration', 'type': 'str'}, - 'rehydration_priority': {'key': 'rehydrationPriority', 'type': 'str'}, + "rehydration_retention_duration": {"key": "rehydrationRetentionDuration", "type": "str"}, + "rehydration_priority": {"key": "rehydrationPriority", "type": "str"}, } def __init__( self, *, rehydration_retention_duration: Optional[str] = None, - rehydration_priority: Optional[Union[str, "RehydrationPriority"]] = None, + rehydration_priority: Optional[Union[str, "_models.RehydrationPriority"]] = None, **kwargs ): """ :keyword rehydration_retention_duration: How long the rehydrated RP should be kept Should be ISO8601 Duration format e.g. "P7D". :paramtype rehydration_retention_duration: str - :keyword rehydration_priority: Rehydration Priority. Possible values include: "Standard", - "High". + :keyword rehydration_priority: Rehydration Priority. Known values are: "Standard" and "High". :paramtype rehydration_priority: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RehydrationPriority """ - super(RecoveryPointRehydrationInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.rehydration_retention_duration = rehydration_retention_duration self.rehydration_priority = rehydration_priority @@ -18155,7 +19310,7 @@ class RecoveryPointResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -18164,19 +19319,19 @@ class RecoveryPointResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryPoint'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "RecoveryPoint"}, } def __init__( @@ -18185,20 +19340,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["RecoveryPoint"] = None, + properties: Optional["_models.RecoveryPoint"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: RecoveryPointResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPoint """ - super(RecoveryPointResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -18214,15 +19369,15 @@ class RecoveryPointResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[RecoveryPointResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RecoveryPointResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["RecoveryPointResource"]] = None, + value: Optional[List["_models.RecoveryPointResource"]] = None, **kwargs ): """ @@ -18233,19 +19388,19 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] """ - super(RecoveryPointResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class RecoveryPointTierInformation(msrest.serialization.Model): +class RecoveryPointTierInformation(_serialization.Model): """Recovery point tier information. - :ivar type: Recovery point tier type. Possible values include: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + :ivar type: Recovery point tier type. Known values are: "Invalid", "InstantRP", "HardenedRP", + and "ArchivedRP". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType - :ivar status: Recovery point tier status. Possible values include: "Invalid", "Valid", - "Disabled", "Deleted", "Rehydrated". + :ivar status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", + "Deleted", and "Rehydrated". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierStatus :ivar extended_info: Recovery point tier status. @@ -18253,32 +19408,32 @@ class RecoveryPointTierInformation(msrest.serialization.Model): """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': '{str}'}, + "type": {"key": "type", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "{str}"}, } def __init__( self, *, - type: Optional[Union[str, "RecoveryPointTierType"]] = None, - status: Optional[Union[str, "RecoveryPointTierStatus"]] = None, + type: Optional[Union[str, "_models.RecoveryPointTierType"]] = None, + status: Optional[Union[str, "_models.RecoveryPointTierStatus"]] = None, extended_info: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword type: Recovery point tier type. Possible values include: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + :keyword type: Recovery point tier type. Known values are: "Invalid", "InstantRP", + "HardenedRP", and "ArchivedRP". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType - :keyword status: Recovery point tier status. Possible values include: "Invalid", "Valid", - "Disabled", "Deleted", "Rehydrated". + :keyword status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", + "Deleted", and "Rehydrated". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierStatus :keyword extended_info: Recovery point tier status. :paramtype extended_info: dict[str, str] """ - super(RecoveryPointTierInformation, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.status = status self.extended_info = extended_info @@ -18287,12 +19442,12 @@ def __init__( class RecoveryPointTierInformationV2(RecoveryPointTierInformation): """RecoveryPoint Tier Information V2. - :ivar type: Recovery point tier type. Possible values include: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + :ivar type: Recovery point tier type. Known values are: "Invalid", "InstantRP", "HardenedRP", + and "ArchivedRP". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType - :ivar status: Recovery point tier status. Possible values include: "Invalid", "Valid", - "Disabled", "Deleted", "Rehydrated". + :ivar status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", + "Deleted", and "Rehydrated". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierStatus :ivar extended_info: Recovery point tier status. @@ -18300,35 +19455,35 @@ class RecoveryPointTierInformationV2(RecoveryPointTierInformation): """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': '{str}'}, + "type": {"key": "type", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "{str}"}, } def __init__( self, *, - type: Optional[Union[str, "RecoveryPointTierType"]] = None, - status: Optional[Union[str, "RecoveryPointTierStatus"]] = None, + type: Optional[Union[str, "_models.RecoveryPointTierType"]] = None, + status: Optional[Union[str, "_models.RecoveryPointTierStatus"]] = None, extended_info: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword type: Recovery point tier type. Possible values include: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + :keyword type: Recovery point tier type. Known values are: "Invalid", "InstantRP", + "HardenedRP", and "ArchivedRP". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType - :keyword status: Recovery point tier status. Possible values include: "Invalid", "Valid", - "Disabled", "Deleted", "Rehydrated". + :keyword status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", + "Deleted", and "Rehydrated". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierStatus :keyword extended_info: Recovery point tier status. :paramtype extended_info: dict[str, str] """ - super(RecoveryPointTierInformationV2, self).__init__(type=type, status=status, extended_info=extended_info, **kwargs) + super().__init__(type=type, status=status, extended_info=extended_info, **kwargs) -class ResourceGuardOperationDetail(msrest.serialization.Model): +class ResourceGuardOperationDetail(_serialization.Model): """ResourceGuardOperationDetail. :ivar vault_critical_operation: @@ -18338,8 +19493,8 @@ class ResourceGuardOperationDetail(msrest.serialization.Model): """ _attribute_map = { - 'vault_critical_operation': {'key': 'vaultCriticalOperation', 'type': 'str'}, - 'default_resource_request': {'key': 'defaultResourceRequest', 'type': 'str'}, + "vault_critical_operation": {"key": "vaultCriticalOperation", "type": "str"}, + "default_resource_request": {"key": "defaultResourceRequest", "type": "str"}, } def __init__( @@ -18355,12 +19510,12 @@ def __init__( :keyword default_resource_request: :paramtype default_resource_request: str """ - super(ResourceGuardOperationDetail, self).__init__(**kwargs) + super().__init__(**kwargs) self.vault_critical_operation = vault_critical_operation self.default_resource_request = default_resource_request -class ResourceGuardProxyBase(msrest.serialization.Model): +class ResourceGuardProxyBase(_serialization.Model): """ResourceGuardProxyBase. :ivar resource_guard_resource_id: @@ -18375,17 +19530,20 @@ class ResourceGuardProxyBase(msrest.serialization.Model): """ _attribute_map = { - 'resource_guard_resource_id': {'key': 'resourceGuardResourceId', 'type': 'str'}, - 'resource_guard_operation_details': {'key': 'resourceGuardOperationDetails', 'type': '[ResourceGuardOperationDetail]'}, - 'last_updated_time': {'key': 'lastUpdatedTime', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, + "resource_guard_resource_id": {"key": "resourceGuardResourceId", "type": "str"}, + "resource_guard_operation_details": { + "key": "resourceGuardOperationDetails", + "type": "[ResourceGuardOperationDetail]", + }, + "last_updated_time": {"key": "lastUpdatedTime", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( self, *, resource_guard_resource_id: Optional[str] = None, - resource_guard_operation_details: Optional[List["ResourceGuardOperationDetail"]] = None, + resource_guard_operation_details: Optional[List["_models.ResourceGuardOperationDetail"]] = None, last_updated_time: Optional[str] = None, description: Optional[str] = None, **kwargs @@ -18401,7 +19559,7 @@ def __init__( :keyword description: :paramtype description: str """ - super(ResourceGuardProxyBase, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_guard_resource_id = resource_guard_resource_id self.resource_guard_operation_details = resource_guard_operation_details self.last_updated_time = last_updated_time @@ -18422,7 +19580,7 @@ class ResourceGuardProxyBaseResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -18432,19 +19590,19 @@ class ResourceGuardProxyBaseResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ResourceGuardProxyBase'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ResourceGuardProxyBase"}, } def __init__( @@ -18453,13 +19611,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ResourceGuardProxyBase"] = None, + properties: Optional["_models.ResourceGuardProxyBase"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -18467,7 +19625,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBase """ - super(ResourceGuardProxyBaseResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -18483,15 +19641,15 @@ class ResourceGuardProxyBaseResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ResourceGuardProxyBaseResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ResourceGuardProxyBaseResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ResourceGuardProxyBaseResource"]] = None, + value: Optional[List["_models.ResourceGuardProxyBaseResource"]] = None, **kwargs ): """ @@ -18502,11 +19660,11 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource] """ - super(ResourceGuardProxyBaseResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class RestoreFileSpecs(msrest.serialization.Model): +class RestoreFileSpecs(_serialization.Model): """Restore file specs like file path, type and target folder path info. :ivar path: Source File/Folder path. @@ -18518,9 +19676,9 @@ class RestoreFileSpecs(msrest.serialization.Model): """ _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'file_spec_type': {'key': 'fileSpecType', 'type': 'str'}, - 'target_folder_path': {'key': 'targetFolderPath', 'type': 'str'}, + "path": {"key": "path", "type": "str"}, + "file_spec_type": {"key": "fileSpecType", "type": "str"}, + "target_folder_path": {"key": "targetFolderPath", "type": "str"}, } def __init__( @@ -18539,7 +19697,7 @@ def __init__( :keyword target_folder_path: Destination folder path in target FileShare. :paramtype target_folder_path: str """ - super(RestoreFileSpecs, self).__init__(**kwargs) + super().__init__(**kwargs) self.path = path self.file_spec_type = file_spec_type self.target_folder_path = target_folder_path @@ -18559,7 +19717,7 @@ class RestoreRequestResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -18568,19 +19726,19 @@ class RestoreRequestResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RestoreRequest'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "RestoreRequest"}, } def __init__( @@ -18589,46 +19747,46 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["RestoreRequest"] = None, + properties: Optional["_models.RestoreRequest"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: RestoreRequestResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ - super(RestoreRequestResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class RetentionDuration(msrest.serialization.Model): +class RetentionDuration(_serialization.Model): """Retention duration. :ivar count: Count of duration types. Retention duration is obtained by the counting the duration type Count times. For example, when Count = 3 and DurationType = Weeks, retention duration will be three weeks. :vartype count: int - :ivar duration_type: Retention duration type of retention policy. Possible values include: - "Invalid", "Days", "Weeks", "Months", "Years". + :ivar duration_type: Retention duration type of retention policy. Known values are: "Invalid", + "Days", "Weeks", "Months", and "Years". :vartype duration_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType """ _attribute_map = { - 'count': {'key': 'count', 'type': 'int'}, - 'duration_type': {'key': 'durationType', 'type': 'str'}, + "count": {"key": "count", "type": "int"}, + "duration_type": {"key": "durationType", "type": "str"}, } def __init__( self, *, count: Optional[int] = None, - duration_type: Optional[Union[str, "RetentionDurationType"]] = None, + duration_type: Optional[Union[str, "_models.RetentionDurationType"]] = None, **kwargs ): """ @@ -18636,17 +19794,17 @@ def __init__( duration type Count times. For example, when Count = 3 and DurationType = Weeks, retention duration will be three weeks. :paramtype count: int - :keyword duration_type: Retention duration type of retention policy. Possible values include: - "Invalid", "Days", "Weeks", "Months", "Years". + :keyword duration_type: Retention duration type of retention policy. Known values are: + "Invalid", "Days", "Weeks", "Months", and "Years". :paramtype duration_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType """ - super(RetentionDuration, self).__init__(**kwargs) + super().__init__(**kwargs) self.count = count self.duration_type = duration_type -class SecurityPinBase(msrest.serialization.Model): +class SecurityPinBase(_serialization.Model): """Base class for get security pin request body. :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. @@ -18654,24 +19812,19 @@ class SecurityPinBase(msrest.serialization.Model): """ _attribute_map = { - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, } - def __init__( - self, - *, - resource_guard_operation_requests: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, resource_guard_operation_requests: Optional[List[str]] = None, **kwargs): """ :keyword resource_guard_operation_requests: ResourceGuard Operation Requests. :paramtype resource_guard_operation_requests: list[str] """ - super(SecurityPinBase, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_guard_operation_requests = resource_guard_operation_requests -class Settings(msrest.serialization.Model): +class Settings(_serialization.Model): """Common settings field for backup management. :ivar time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific Standard @@ -18685,9 +19838,9 @@ class Settings(msrest.serialization.Model): """ _attribute_map = { - 'time_zone': {'key': 'timeZone', 'type': 'str'}, - 'issqlcompression': {'key': 'issqlcompression', 'type': 'bool'}, - 'is_compression': {'key': 'isCompression', 'type': 'bool'}, + "time_zone": {"key": "timeZone", "type": "str"}, + "issqlcompression": {"key": "issqlcompression", "type": "bool"}, + "is_compression": {"key": "isCompression", "type": "bool"}, } def __init__( @@ -18709,7 +19862,7 @@ def __init__( will be deprecated once clients upgrade to consider this flag. :paramtype is_compression: bool """ - super(Settings, self).__init__(**kwargs) + super().__init__(**kwargs) self.time_zone = time_zone self.issqlcompression = issqlcompression self.is_compression = is_compression @@ -18720,8 +19873,8 @@ class SimpleRetentionPolicy(RetentionPolicy): All required parameters must be populated in order to send to Azure. - :ivar retention_policy_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. + :ivar retention_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype retention_policy_type: str :ivar retention_duration: Retention duration of the protection policy. :vartype retention_duration: @@ -18729,27 +19882,22 @@ class SimpleRetentionPolicy(RetentionPolicy): """ _validation = { - 'retention_policy_type': {'required': True}, + "retention_policy_type": {"required": True}, } _attribute_map = { - 'retention_policy_type': {'key': 'retentionPolicyType', 'type': 'str'}, - 'retention_duration': {'key': 'retentionDuration', 'type': 'RetentionDuration'}, + "retention_policy_type": {"key": "retentionPolicyType", "type": "str"}, + "retention_duration": {"key": "retentionDuration", "type": "RetentionDuration"}, } - def __init__( - self, - *, - retention_duration: Optional["RetentionDuration"] = None, - **kwargs - ): + def __init__(self, *, retention_duration: Optional["_models.RetentionDuration"] = None, **kwargs): """ :keyword retention_duration: Retention duration of the protection policy. :paramtype retention_duration: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDuration """ - super(SimpleRetentionPolicy, self).__init__(**kwargs) - self.retention_policy_type = 'SimpleRetentionPolicy' # type: str + super().__init__(**kwargs) + self.retention_policy_type = "SimpleRetentionPolicy" # type: str self.retention_duration = retention_duration @@ -18758,11 +19906,11 @@ class SimpleSchedulePolicy(SchedulePolicy): All required parameters must be populated in order to send to Azure. - :ivar schedule_policy_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. + :ivar schedule_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype schedule_policy_type: str - :ivar schedule_run_frequency: Frequency of the schedule operation of this policy. Possible - values include: "Invalid", "Daily", "Weekly", "Hourly". + :ivar schedule_run_frequency: Frequency of the schedule operation of this policy. Known values + are: "Invalid", "Daily", "Weekly", and "Hourly". :vartype schedule_run_frequency: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ScheduleRunType :ivar schedule_run_days: List of days of week this schedule has to be run. @@ -18777,31 +19925,31 @@ class SimpleSchedulePolicy(SchedulePolicy): """ _validation = { - 'schedule_policy_type': {'required': True}, + "schedule_policy_type": {"required": True}, } _attribute_map = { - 'schedule_policy_type': {'key': 'schedulePolicyType', 'type': 'str'}, - 'schedule_run_frequency': {'key': 'scheduleRunFrequency', 'type': 'str'}, - 'schedule_run_days': {'key': 'scheduleRunDays', 'type': '[str]'}, - 'schedule_run_times': {'key': 'scheduleRunTimes', 'type': '[iso-8601]'}, - 'hourly_schedule': {'key': 'hourlySchedule', 'type': 'HourlySchedule'}, - 'schedule_weekly_frequency': {'key': 'scheduleWeeklyFrequency', 'type': 'int'}, + "schedule_policy_type": {"key": "schedulePolicyType", "type": "str"}, + "schedule_run_frequency": {"key": "scheduleRunFrequency", "type": "str"}, + "schedule_run_days": {"key": "scheduleRunDays", "type": "[str]"}, + "schedule_run_times": {"key": "scheduleRunTimes", "type": "[iso-8601]"}, + "hourly_schedule": {"key": "hourlySchedule", "type": "HourlySchedule"}, + "schedule_weekly_frequency": {"key": "scheduleWeeklyFrequency", "type": "int"}, } def __init__( self, *, - schedule_run_frequency: Optional[Union[str, "ScheduleRunType"]] = None, - schedule_run_days: Optional[List[Union[str, "DayOfWeek"]]] = None, + schedule_run_frequency: Optional[Union[str, "_models.ScheduleRunType"]] = None, + schedule_run_days: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, schedule_run_times: Optional[List[datetime.datetime]] = None, - hourly_schedule: Optional["HourlySchedule"] = None, + hourly_schedule: Optional["_models.HourlySchedule"] = None, schedule_weekly_frequency: Optional[int] = None, **kwargs ): """ - :keyword schedule_run_frequency: Frequency of the schedule operation of this policy. Possible - values include: "Invalid", "Daily", "Weekly", "Hourly". + :keyword schedule_run_frequency: Frequency of the schedule operation of this policy. Known + values are: "Invalid", "Daily", "Weekly", and "Hourly". :paramtype schedule_run_frequency: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ScheduleRunType :keyword schedule_run_days: List of days of week this schedule has to be run. @@ -18815,8 +19963,8 @@ def __init__( :keyword schedule_weekly_frequency: At every number weeks this schedule has to be run. :paramtype schedule_weekly_frequency: int """ - super(SimpleSchedulePolicy, self).__init__(**kwargs) - self.schedule_policy_type = 'SimpleSchedulePolicy' # type: str + super().__init__(**kwargs) + self.schedule_policy_type = "SimpleSchedulePolicy" # type: str self.schedule_run_frequency = schedule_run_frequency self.schedule_run_days = schedule_run_days self.schedule_run_times = schedule_run_times @@ -18829,11 +19977,11 @@ class SimpleSchedulePolicyV2(SchedulePolicy): All required parameters must be populated in order to send to Azure. - :ivar schedule_policy_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. + :ivar schedule_policy_type: This property will be used as the discriminator for deciding the + specific types in the polymorphic chain of types. Required. :vartype schedule_policy_type: str - :ivar schedule_run_frequency: Frequency of the schedule operation of this policy. Possible - values include: "Invalid", "Daily", "Weekly", "Hourly". + :ivar schedule_run_frequency: Frequency of the schedule operation of this policy. Known values + are: "Invalid", "Daily", "Weekly", and "Hourly". :vartype schedule_run_frequency: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ScheduleRunType :ivar hourly_schedule: hourly schedule of this policy. @@ -18845,29 +19993,29 @@ class SimpleSchedulePolicyV2(SchedulePolicy): """ _validation = { - 'schedule_policy_type': {'required': True}, + "schedule_policy_type": {"required": True}, } _attribute_map = { - 'schedule_policy_type': {'key': 'schedulePolicyType', 'type': 'str'}, - 'schedule_run_frequency': {'key': 'scheduleRunFrequency', 'type': 'str'}, - 'hourly_schedule': {'key': 'hourlySchedule', 'type': 'HourlySchedule'}, - 'daily_schedule': {'key': 'dailySchedule', 'type': 'DailySchedule'}, - 'weekly_schedule': {'key': 'weeklySchedule', 'type': 'WeeklySchedule'}, + "schedule_policy_type": {"key": "schedulePolicyType", "type": "str"}, + "schedule_run_frequency": {"key": "scheduleRunFrequency", "type": "str"}, + "hourly_schedule": {"key": "hourlySchedule", "type": "HourlySchedule"}, + "daily_schedule": {"key": "dailySchedule", "type": "DailySchedule"}, + "weekly_schedule": {"key": "weeklySchedule", "type": "WeeklySchedule"}, } def __init__( self, *, - schedule_run_frequency: Optional[Union[str, "ScheduleRunType"]] = None, - hourly_schedule: Optional["HourlySchedule"] = None, - daily_schedule: Optional["DailySchedule"] = None, - weekly_schedule: Optional["WeeklySchedule"] = None, + schedule_run_frequency: Optional[Union[str, "_models.ScheduleRunType"]] = None, + hourly_schedule: Optional["_models.HourlySchedule"] = None, + daily_schedule: Optional["_models.DailySchedule"] = None, + weekly_schedule: Optional["_models.WeeklySchedule"] = None, **kwargs ): """ - :keyword schedule_run_frequency: Frequency of the schedule operation of this policy. Possible - values include: "Invalid", "Daily", "Weekly", "Hourly". + :keyword schedule_run_frequency: Frequency of the schedule operation of this policy. Known + values are: "Invalid", "Daily", "Weekly", and "Hourly". :paramtype schedule_run_frequency: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ScheduleRunType :keyword hourly_schedule: hourly schedule of this policy. @@ -18879,18 +20027,18 @@ def __init__( :paramtype weekly_schedule: ~azure.mgmt.recoveryservicesbackup.activestamp.models.WeeklySchedule """ - super(SimpleSchedulePolicyV2, self).__init__(**kwargs) - self.schedule_policy_type = 'SimpleSchedulePolicyV2' # type: str + super().__init__(**kwargs) + self.schedule_policy_type = "SimpleSchedulePolicyV2" # type: str self.schedule_run_frequency = schedule_run_frequency self.hourly_schedule = hourly_schedule self.daily_schedule = daily_schedule self.weekly_schedule = weekly_schedule -class SQLDataDirectory(msrest.serialization.Model): +class SQLDataDirectory(_serialization.Model): """SQLDataDirectory info. - :ivar type: Type of data directory mapping. Possible values include: "Invalid", "Data", "Log". + :ivar type: Type of data directory mapping. Known values are: "Invalid", "Data", and "Log". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectoryType :ivar path: File path. @@ -18900,22 +20048,21 @@ class SQLDataDirectory(msrest.serialization.Model): """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'logical_name': {'key': 'logicalName', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "logical_name": {"key": "logicalName", "type": "str"}, } def __init__( self, *, - type: Optional[Union[str, "SQLDataDirectoryType"]] = None, + type: Optional[Union[str, "_models.SQLDataDirectoryType"]] = None, path: Optional[str] = None, logical_name: Optional[str] = None, **kwargs ): """ - :keyword type: Type of data directory mapping. Possible values include: "Invalid", "Data", - "Log". + :keyword type: Type of data directory mapping. Known values are: "Invalid", "Data", and "Log". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectoryType :keyword path: File path. @@ -18923,16 +20070,16 @@ def __init__( :keyword logical_name: Logical name of the file. :paramtype logical_name: str """ - super(SQLDataDirectory, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.path = path self.logical_name = logical_name -class SQLDataDirectoryMapping(msrest.serialization.Model): +class SQLDataDirectoryMapping(_serialization.Model): """Encapsulates information regarding data directory. - :ivar mapping_type: Type of data directory mapping. Possible values include: "Invalid", "Data", + :ivar mapping_type: Type of data directory mapping. Known values are: "Invalid", "Data", and "Log". :vartype mapping_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectoryType @@ -18945,24 +20092,24 @@ class SQLDataDirectoryMapping(msrest.serialization.Model): """ _attribute_map = { - 'mapping_type': {'key': 'mappingType', 'type': 'str'}, - 'source_logical_name': {'key': 'sourceLogicalName', 'type': 'str'}, - 'source_path': {'key': 'sourcePath', 'type': 'str'}, - 'target_path': {'key': 'targetPath', 'type': 'str'}, + "mapping_type": {"key": "mappingType", "type": "str"}, + "source_logical_name": {"key": "sourceLogicalName", "type": "str"}, + "source_path": {"key": "sourcePath", "type": "str"}, + "target_path": {"key": "targetPath", "type": "str"}, } def __init__( self, *, - mapping_type: Optional[Union[str, "SQLDataDirectoryType"]] = None, + mapping_type: Optional[Union[str, "_models.SQLDataDirectoryType"]] = None, source_logical_name: Optional[str] = None, source_path: Optional[str] = None, target_path: Optional[str] = None, **kwargs ): """ - :keyword mapping_type: Type of data directory mapping. Possible values include: "Invalid", - "Data", "Log". + :keyword mapping_type: Type of data directory mapping. Known values are: "Invalid", "Data", and + "Log". :paramtype mapping_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SQLDataDirectoryType :keyword source_logical_name: Restore source logical name path. @@ -18972,43 +20119,52 @@ def __init__( :keyword target_path: Target path. :paramtype target_path: str """ - super(SQLDataDirectoryMapping, self).__init__(**kwargs) + super().__init__(**kwargs) self.mapping_type = mapping_type self.source_logical_name = source_logical_name self.source_path = source_path self.target_path = target_path -class SubProtectionPolicy(msrest.serialization.Model): +class SubProtectionPolicy(_serialization.Model): """Sub-protection policy which includes schedule and retention. - :ivar policy_type: Type of backup policy type. Possible values include: "Invalid", "Full", - "Differential", "Log", "CopyOnlyFull", "Incremental". + :ivar policy_type: Type of backup policy type. Known values are: "Invalid", "Full", + "Differential", "Log", "CopyOnlyFull", "Incremental", "SnapshotFull", and + "SnapshotCopyOnlyFull". :vartype policy_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.PolicyType :ivar schedule_policy: Backup schedule specified as part of backup policy. :vartype schedule_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SchedulePolicy :ivar retention_policy: Retention policy with the details on backup copy retention ranges. :vartype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :ivar tiering_policy: Tiering policy to automatically move RPs to another tier. + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :vartype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] """ _attribute_map = { - 'policy_type': {'key': 'policyType', 'type': 'str'}, - 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + "policy_type": {"key": "policyType", "type": "str"}, + "schedule_policy": {"key": "schedulePolicy", "type": "SchedulePolicy"}, + "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, + "tiering_policy": {"key": "tieringPolicy", "type": "{TieringPolicy}"}, } def __init__( self, *, - policy_type: Optional[Union[str, "PolicyType"]] = None, - schedule_policy: Optional["SchedulePolicy"] = None, - retention_policy: Optional["RetentionPolicy"] = None, + policy_type: Optional[Union[str, "_models.PolicyType"]] = None, + schedule_policy: Optional["_models.SchedulePolicy"] = None, + retention_policy: Optional["_models.RetentionPolicy"] = None, + tiering_policy: Optional[Dict[str, "_models.TieringPolicy"]] = None, **kwargs ): """ - :keyword policy_type: Type of backup policy type. Possible values include: "Invalid", "Full", - "Differential", "Log", "CopyOnlyFull", "Incremental". + :keyword policy_type: Type of backup policy type. Known values are: "Invalid", "Full", + "Differential", "Log", "CopyOnlyFull", "Incremental", "SnapshotFull", and + "SnapshotCopyOnlyFull". :paramtype policy_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.PolicyType :keyword schedule_policy: Backup schedule specified as part of backup policy. :paramtype schedule_policy: @@ -19016,14 +20172,20 @@ def __init__( :keyword retention_policy: Retention policy with the details on backup copy retention ranges. :paramtype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :keyword tiering_policy: Tiering policy to automatically move RPs to another tier. + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :paramtype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] """ - super(SubProtectionPolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.policy_type = policy_type self.schedule_policy = schedule_policy self.retention_policy = retention_policy + self.tiering_policy = tiering_policy -class TargetAFSRestoreInfo(msrest.serialization.Model): +class TargetAFSRestoreInfo(_serialization.Model): """Target Azure File Share Info. :ivar name: File share name. @@ -19033,33 +20195,27 @@ class TargetAFSRestoreInfo(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "target_resource_id": {"key": "targetResourceId", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - target_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, target_resource_id: Optional[str] = None, **kwargs): """ :keyword name: File share name. :paramtype name: str :keyword target_resource_id: Target file share resource ARM ID. :paramtype target_resource_id: str """ - super(TargetAFSRestoreInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.target_resource_id = target_resource_id -class TargetRestoreInfo(msrest.serialization.Model): +class TargetRestoreInfo(_serialization.Model): """Details about target workload during restore operation. - :ivar overwrite_option: Can Overwrite if Target DataBase already exists. Possible values - include: "Invalid", "FailOnConflict", "Overwrite". + :ivar overwrite_option: Can Overwrite if Target DataBase already exists. Known values are: + "Invalid", "FailOnConflict", and "Overwrite". :vartype overwrite_option: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OverwriteOptions :ivar container_id: Resource Id name of the container in which Target DataBase resides. @@ -19072,24 +20228,24 @@ class TargetRestoreInfo(msrest.serialization.Model): """ _attribute_map = { - 'overwrite_option': {'key': 'overwriteOption', 'type': 'str'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, - 'database_name': {'key': 'databaseName', 'type': 'str'}, - 'target_directory_for_file_restore': {'key': 'targetDirectoryForFileRestore', 'type': 'str'}, + "overwrite_option": {"key": "overwriteOption", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "target_directory_for_file_restore": {"key": "targetDirectoryForFileRestore", "type": "str"}, } def __init__( self, *, - overwrite_option: Optional[Union[str, "OverwriteOptions"]] = None, + overwrite_option: Optional[Union[str, "_models.OverwriteOptions"]] = None, container_id: Optional[str] = None, database_name: Optional[str] = None, target_directory_for_file_restore: Optional[str] = None, **kwargs ): """ - :keyword overwrite_option: Can Overwrite if Target DataBase already exists. Possible values - include: "Invalid", "FailOnConflict", "Overwrite". + :keyword overwrite_option: Can Overwrite if Target DataBase already exists. Known values are: + "Invalid", "FailOnConflict", and "Overwrite". :paramtype overwrite_option: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OverwriteOptions :keyword container_id: Resource Id name of the container in which Target DataBase resides. @@ -19100,28 +20256,95 @@ def __init__( :keyword target_directory_for_file_restore: Target directory location for restore as files. :paramtype target_directory_for_file_restore: str """ - super(TargetRestoreInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.overwrite_option = overwrite_option self.container_id = container_id self.database_name = database_name self.target_directory_for_file_restore = target_directory_for_file_restore -class TokenInformation(msrest.serialization.Model): +class TieringPolicy(_serialization.Model): + """Tiering Policy for a target tier. + If the policy is not specified for a given target tier, service retains the existing configured tiering policy for that tier. + + :ivar tiering_mode: Tiering Mode to control automatic tiering of recovery points. Supported + values are: + + + #. TierRecommended: Tier all recovery points recommended to be tiered + #. TierAfter: Tier all recovery points after a fixed period, as specified in duration + + durationType below. + #. DoNotTier: Do not tier any recovery points. Known values are: "Invalid", "TierRecommended", + "TierAfter", and "DoNotTier". + :vartype tiering_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringMode + :ivar duration: Number of days/weeks/months/years to retain backups in current tier before + tiering. + Used only if TieringMode is set to TierAfter. + :vartype duration: int + :ivar duration_type: Retention duration type: days/weeks/months/years + Used only if TieringMode is set to TierAfter. Known values are: "Invalid", "Days", "Weeks", + "Months", and "Years". + :vartype duration_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType + """ + + _attribute_map = { + "tiering_mode": {"key": "tieringMode", "type": "str"}, + "duration": {"key": "duration", "type": "int"}, + "duration_type": {"key": "durationType", "type": "str"}, + } + + def __init__( + self, + *, + tiering_mode: Optional[Union[str, "_models.TieringMode"]] = None, + duration: Optional[int] = None, + duration_type: Optional[Union[str, "_models.RetentionDurationType"]] = None, + **kwargs + ): + """ + :keyword tiering_mode: Tiering Mode to control automatic tiering of recovery points. Supported + values are: + + + #. TierRecommended: Tier all recovery points recommended to be tiered + #. TierAfter: Tier all recovery points after a fixed period, as specified in duration + + durationType below. + #. DoNotTier: Do not tier any recovery points. Known values are: "Invalid", "TierRecommended", + "TierAfter", and "DoNotTier". + :paramtype tiering_mode: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringMode + :keyword duration: Number of days/weeks/months/years to retain backups in current tier before + tiering. + Used only if TieringMode is set to TierAfter. + :paramtype duration: int + :keyword duration_type: Retention duration type: days/weeks/months/years + Used only if TieringMode is set to TierAfter. Known values are: "Invalid", "Days", "Weeks", + "Months", and "Years". + :paramtype duration_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType + """ + super().__init__(**kwargs) + self.tiering_mode = tiering_mode + self.duration = duration + self.duration_type = duration_type + + +class TokenInformation(_serialization.Model): """The token information details. :ivar token: Token value. :vartype token: str :ivar expiry_time_in_utc_ticks: Expiry time of token. - :vartype expiry_time_in_utc_ticks: long + :vartype expiry_time_in_utc_ticks: int :ivar security_pin: Security PIN. :vartype security_pin: str """ _attribute_map = { - 'token': {'key': 'token', 'type': 'str'}, - 'expiry_time_in_utc_ticks': {'key': 'expiryTimeInUtcTicks', 'type': 'long'}, - 'security_pin': {'key': 'securityPIN', 'type': 'str'}, + "token": {"key": "token", "type": "str"}, + "expiry_time_in_utc_ticks": {"key": "expiryTimeInUtcTicks", "type": "int"}, + "security_pin": {"key": "securityPIN", "type": "str"}, } def __init__( @@ -19136,30 +20359,30 @@ def __init__( :keyword token: Token value. :paramtype token: str :keyword expiry_time_in_utc_ticks: Expiry time of token. - :paramtype expiry_time_in_utc_ticks: long + :paramtype expiry_time_in_utc_ticks: int :keyword security_pin: Security PIN. :paramtype security_pin: str """ - super(TokenInformation, self).__init__(**kwargs) + super().__init__(**kwargs) self.token = token self.expiry_time_in_utc_ticks = expiry_time_in_utc_ticks self.security_pin = security_pin -class TriggerDataMoveRequest(msrest.serialization.Model): +class TriggerDataMoveRequest(_serialization.Model): """Trigger DataMove Request. All required parameters must be populated in order to send to Azure. - :ivar source_resource_id: Required. ARM Id of source vault. + :ivar source_resource_id: ARM Id of source vault. Required. :vartype source_resource_id: str - :ivar source_region: Required. Source Region. + :ivar source_region: Source Region. Required. :vartype source_region: str - :ivar data_move_level: Required. DataMove Level. Possible values include: "Invalid", "Vault", + :ivar data_move_level: DataMove Level. Required. Known values are: "Invalid", "Vault", and "Container". :vartype data_move_level: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataMoveLevel - :ivar correlation_id: Required. Correlation Id. + :ivar correlation_id: Correlation Id. Required. :vartype correlation_id: str :ivar source_container_arm_ids: Source Container ArmIds. :vartype source_container_arm_ids: list[str] @@ -19168,19 +20391,19 @@ class TriggerDataMoveRequest(msrest.serialization.Model): """ _validation = { - 'source_resource_id': {'required': True}, - 'source_region': {'required': True}, - 'data_move_level': {'required': True}, - 'correlation_id': {'required': True}, + "source_resource_id": {"required": True}, + "source_region": {"required": True}, + "data_move_level": {"required": True}, + "correlation_id": {"required": True}, } _attribute_map = { - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'source_region': {'key': 'sourceRegion', 'type': 'str'}, - 'data_move_level': {'key': 'dataMoveLevel', 'type': 'str'}, - 'correlation_id': {'key': 'correlationId', 'type': 'str'}, - 'source_container_arm_ids': {'key': 'sourceContainerArmIds', 'type': '[str]'}, - 'pause_gc': {'key': 'pauseGC', 'type': 'bool'}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "source_region": {"key": "sourceRegion", "type": "str"}, + "data_move_level": {"key": "dataMoveLevel", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "source_container_arm_ids": {"key": "sourceContainerArmIds", "type": "[str]"}, + "pause_gc": {"key": "pauseGC", "type": "bool"}, } def __init__( @@ -19188,29 +20411,29 @@ def __init__( *, source_resource_id: str, source_region: str, - data_move_level: Union[str, "DataMoveLevel"], + data_move_level: Union[str, "_models.DataMoveLevel"], correlation_id: str, source_container_arm_ids: Optional[List[str]] = None, pause_gc: Optional[bool] = None, **kwargs ): """ - :keyword source_resource_id: Required. ARM Id of source vault. + :keyword source_resource_id: ARM Id of source vault. Required. :paramtype source_resource_id: str - :keyword source_region: Required. Source Region. + :keyword source_region: Source Region. Required. :paramtype source_region: str - :keyword data_move_level: Required. DataMove Level. Possible values include: "Invalid", - "Vault", "Container". + :keyword data_move_level: DataMove Level. Required. Known values are: "Invalid", "Vault", and + "Container". :paramtype data_move_level: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataMoveLevel - :keyword correlation_id: Required. Correlation Id. + :keyword correlation_id: Correlation Id. Required. :paramtype correlation_id: str :keyword source_container_arm_ids: Source Container ArmIds. :paramtype source_container_arm_ids: list[str] :keyword pause_gc: Pause GC. :paramtype pause_gc: bool """ - super(TriggerDataMoveRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.source_resource_id = source_resource_id self.source_region = source_region self.data_move_level = data_move_level @@ -19219,7 +20442,7 @@ def __init__( self.pause_gc = pause_gc -class UnlockDeleteRequest(msrest.serialization.Model): +class UnlockDeleteRequest(_serialization.Model): """Request body of unlock delete API. :ivar resource_guard_operation_requests: @@ -19229,8 +20452,8 @@ class UnlockDeleteRequest(msrest.serialization.Model): """ _attribute_map = { - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'resource_to_be_deleted': {'key': 'resourceToBeDeleted', 'type': 'str'}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "resource_to_be_deleted": {"key": "resourceToBeDeleted", "type": "str"}, } def __init__( @@ -19246,12 +20469,12 @@ def __init__( :keyword resource_to_be_deleted: :paramtype resource_to_be_deleted: str """ - super(UnlockDeleteRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_guard_operation_requests = resource_guard_operation_requests self.resource_to_be_deleted = resource_to_be_deleted -class UnlockDeleteResponse(msrest.serialization.Model): +class UnlockDeleteResponse(_serialization.Model): """Response of Unlock Delete API. :ivar unlock_delete_expiry_time: This is the time when unlock delete privileges will get @@ -19260,100 +20483,82 @@ class UnlockDeleteResponse(msrest.serialization.Model): """ _attribute_map = { - 'unlock_delete_expiry_time': {'key': 'unlockDeleteExpiryTime', 'type': 'str'}, + "unlock_delete_expiry_time": {"key": "unlockDeleteExpiryTime", "type": "str"}, } - def __init__( - self, - *, - unlock_delete_expiry_time: Optional[str] = None, - **kwargs - ): + def __init__(self, *, unlock_delete_expiry_time: Optional[str] = None, **kwargs): """ :keyword unlock_delete_expiry_time: This is the time when unlock delete privileges will get expired. :paramtype unlock_delete_expiry_time: str """ - super(UnlockDeleteResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.unlock_delete_expiry_time = unlock_delete_expiry_time -class ValidateOperationRequest(msrest.serialization.Model): +class ValidateOperationRequest(_serialization.Model): """Base class for validate operation request. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ValidateRestoreOperationRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ValidateRestoreOperationRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } - _subtype_map = { - 'object_type': {'ValidateRestoreOperationRequest': 'ValidateRestoreOperationRequest'} - } + _subtype_map = {"object_type": {"ValidateRestoreOperationRequest": "ValidateRestoreOperationRequest"}} - def __init__( - self, - **kwargs - ): - """ - """ - super(ValidateOperationRequest, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] class ValidateRestoreOperationRequest(ValidateOperationRequest): """AzureRestoreValidation request. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ValidateIaasVMRestoreOperationRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ValidateIaasVMRestoreOperationRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar restore_request: Sets restore request to be validated. :vartype restore_request: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'restore_request': {'key': 'restoreRequest', 'type': 'RestoreRequest'}, + "object_type": {"key": "objectType", "type": "str"}, + "restore_request": {"key": "restoreRequest", "type": "RestoreRequest"}, } - _subtype_map = { - 'object_type': {'ValidateIaasVMRestoreOperationRequest': 'ValidateIaasVMRestoreOperationRequest'} - } + _subtype_map = {"object_type": {"ValidateIaasVMRestoreOperationRequest": "ValidateIaasVMRestoreOperationRequest"}} - def __init__( - self, - *, - restore_request: Optional["RestoreRequest"] = None, - **kwargs - ): + def __init__(self, *, restore_request: Optional["_models.RestoreRequest"] = None, **kwargs): """ :keyword restore_request: Sets restore request to be validated. :paramtype restore_request: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ - super(ValidateRestoreOperationRequest, self).__init__(**kwargs) - self.object_type = 'ValidateRestoreOperationRequest' # type: str + super().__init__(**kwargs) + self.object_type = "ValidateRestoreOperationRequest" # type: str self.restore_request = restore_request @@ -19362,38 +20567,33 @@ class ValidateIaasVMRestoreOperationRequest(ValidateRestoreOperationRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar restore_request: Sets restore request to be validated. :vartype restore_request: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'restore_request': {'key': 'restoreRequest', 'type': 'RestoreRequest'}, + "object_type": {"key": "objectType", "type": "str"}, + "restore_request": {"key": "restoreRequest", "type": "RestoreRequest"}, } - def __init__( - self, - *, - restore_request: Optional["RestoreRequest"] = None, - **kwargs - ): + def __init__(self, *, restore_request: Optional["_models.RestoreRequest"] = None, **kwargs): """ :keyword restore_request: Sets restore request to be validated. :paramtype restore_request: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ - super(ValidateIaasVMRestoreOperationRequest, self).__init__(restore_request=restore_request, **kwargs) - self.object_type = 'ValidateIaasVMRestoreOperationRequest' # type: str + super().__init__(restore_request=restore_request, **kwargs) + self.object_type = "ValidateIaasVMRestoreOperationRequest" # type: str -class ValidateOperationResponse(msrest.serialization.Model): +class ValidateOperationResponse(_serialization.Model): """Base class for validate operation response. :ivar validation_results: Gets the validation result. @@ -19402,25 +20602,20 @@ class ValidateOperationResponse(msrest.serialization.Model): """ _attribute_map = { - 'validation_results': {'key': 'validationResults', 'type': '[ErrorDetail]'}, + "validation_results": {"key": "validationResults", "type": "[ErrorDetail]"}, } - def __init__( - self, - *, - validation_results: Optional[List["ErrorDetail"]] = None, - **kwargs - ): + def __init__(self, *, validation_results: Optional[List["_models.ErrorDetail"]] = None, **kwargs): """ :keyword validation_results: Gets the validation result. :paramtype validation_results: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.ErrorDetail] """ - super(ValidateOperationResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.validation_results = validation_results -class ValidateOperationsResponse(msrest.serialization.Model): +class ValidateOperationsResponse(_serialization.Model): """ValidateOperationsResponse. :ivar validate_operation_response: Base class for validate operation response. @@ -19429,34 +20624,29 @@ class ValidateOperationsResponse(msrest.serialization.Model): """ _attribute_map = { - 'validate_operation_response': {'key': 'validateOperationResponse', 'type': 'ValidateOperationResponse'}, + "validate_operation_response": {"key": "validateOperationResponse", "type": "ValidateOperationResponse"}, } - def __init__( - self, - *, - validate_operation_response: Optional["ValidateOperationResponse"] = None, - **kwargs - ): + def __init__(self, *, validate_operation_response: Optional["_models.ValidateOperationResponse"] = None, **kwargs): """ :keyword validate_operation_response: Base class for validate operation response. :paramtype validate_operation_response: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationResponse """ - super(ValidateOperationsResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.validate_operation_response = validate_operation_response -class VaultJob(Job): +class VaultJob(Job): # pylint: disable=too-many-instance-attributes """Vault level Job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :ivar operation: The operation name. @@ -19469,8 +20659,8 @@ class VaultJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed during the execution of this job. :vartype duration: ~datetime.timedelta @@ -19486,47 +20676,47 @@ class VaultJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[VaultJobErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'VaultJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[VaultJobErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "VaultJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["VaultJobErrorInfo"]] = None, - extended_info: Optional["VaultJobExtendedInfo"] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.VaultJobErrorInfo"]] = None, + extended_info: Optional["_models.VaultJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -19551,15 +20741,24 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.VaultJobExtendedInfo """ - super(VaultJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'VaultJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "VaultJob" # type: str self.duration = duration self.actions_info = actions_info self.error_details = error_details self.extended_info = extended_info -class VaultJobErrorInfo(msrest.serialization.Model): +class VaultJobErrorInfo(_serialization.Model): """Vault Job specific error information. :ivar error_code: Error code. @@ -19571,9 +20770,9 @@ class VaultJobErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } def __init__( @@ -19592,13 +20791,13 @@ def __init__( :keyword recommendations: List of localized recommendations for above error code. :paramtype recommendations: list[str] """ - super(VaultJobErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_code = error_code self.error_string = error_string self.recommendations = recommendations -class VaultJobExtendedInfo(msrest.serialization.Model): +class VaultJobExtendedInfo(_serialization.Model): """Vault Job for CMK - has CMK specific info. :ivar property_bag: Job properties. @@ -19606,24 +20805,19 @@ class VaultJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, } - def __init__( - self, - *, - property_bag: Optional[Dict[str, str]] = None, - **kwargs - ): + def __init__(self, *, property_bag: Optional[Dict[str, str]] = None, **kwargs): """ :keyword property_bag: Job properties. :paramtype property_bag: dict[str, str] """ - super(VaultJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.property_bag = property_bag -class WeeklyRetentionFormat(msrest.serialization.Model): +class WeeklyRetentionFormat(_serialization.Model): """Weekly retention format. :ivar days_of_the_week: List of days of the week. @@ -19635,15 +20829,15 @@ class WeeklyRetentionFormat(msrest.serialization.Model): """ _attribute_map = { - 'days_of_the_week': {'key': 'daysOfTheWeek', 'type': '[str]'}, - 'weeks_of_the_month': {'key': 'weeksOfTheMonth', 'type': '[str]'}, + "days_of_the_week": {"key": "daysOfTheWeek", "type": "[str]"}, + "weeks_of_the_month": {"key": "weeksOfTheMonth", "type": "[str]"}, } def __init__( self, *, - days_of_the_week: Optional[List[Union[str, "DayOfWeek"]]] = None, - weeks_of_the_month: Optional[List[Union[str, "WeekOfMonth"]]] = None, + days_of_the_week: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, + weeks_of_the_month: Optional[List[Union[str, "_models.WeekOfMonth"]]] = None, **kwargs ): """ @@ -19654,12 +20848,12 @@ def __init__( :paramtype weeks_of_the_month: list[str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WeekOfMonth] """ - super(WeeklyRetentionFormat, self).__init__(**kwargs) + super().__init__(**kwargs) self.days_of_the_week = days_of_the_week self.weeks_of_the_month = weeks_of_the_month -class WeeklyRetentionSchedule(msrest.serialization.Model): +class WeeklyRetentionSchedule(_serialization.Model): """Weekly retention schedule. :ivar days_of_the_week: List of days of week for weekly retention policy. @@ -19673,17 +20867,17 @@ class WeeklyRetentionSchedule(msrest.serialization.Model): """ _attribute_map = { - 'days_of_the_week': {'key': 'daysOfTheWeek', 'type': '[str]'}, - 'retention_times': {'key': 'retentionTimes', 'type': '[iso-8601]'}, - 'retention_duration': {'key': 'retentionDuration', 'type': 'RetentionDuration'}, + "days_of_the_week": {"key": "daysOfTheWeek", "type": "[str]"}, + "retention_times": {"key": "retentionTimes", "type": "[iso-8601]"}, + "retention_duration": {"key": "retentionDuration", "type": "RetentionDuration"}, } def __init__( self, *, - days_of_the_week: Optional[List[Union[str, "DayOfWeek"]]] = None, + days_of_the_week: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, retention_times: Optional[List[datetime.datetime]] = None, - retention_duration: Optional["RetentionDuration"] = None, + retention_duration: Optional["_models.RetentionDuration"] = None, **kwargs ): """ @@ -19696,13 +20890,13 @@ def __init__( :paramtype retention_duration: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDuration """ - super(WeeklyRetentionSchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.days_of_the_week = days_of_the_week self.retention_times = retention_times self.retention_duration = retention_duration -class WeeklySchedule(msrest.serialization.Model): +class WeeklySchedule(_serialization.Model): """WeeklySchedule. :ivar schedule_run_days: @@ -19713,14 +20907,14 @@ class WeeklySchedule(msrest.serialization.Model): """ _attribute_map = { - 'schedule_run_days': {'key': 'scheduleRunDays', 'type': '[str]'}, - 'schedule_run_times': {'key': 'scheduleRunTimes', 'type': '[iso-8601]'}, + "schedule_run_days": {"key": "scheduleRunDays", "type": "[str]"}, + "schedule_run_times": {"key": "scheduleRunTimes", "type": "[iso-8601]"}, } def __init__( self, *, - schedule_run_days: Optional[List[Union[str, "DayOfWeek"]]] = None, + schedule_run_days: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, schedule_run_times: Optional[List[datetime.datetime]] = None, **kwargs ): @@ -19731,27 +20925,27 @@ def __init__( :keyword schedule_run_times: List of times of day this schedule has to be run. :paramtype schedule_run_times: list[~datetime.datetime] """ - super(WeeklySchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.schedule_run_days = schedule_run_days self.schedule_run_times = schedule_run_times -class WorkloadInquiryDetails(msrest.serialization.Model): +class WorkloadInquiryDetails(_serialization.Model): """Details of an inquired protectable item. :ivar type: Type of the Workload such as SQL, Oracle etc. :vartype type: str :ivar item_count: Contains the protectable item Count inside this Container. - :vartype item_count: long + :vartype item_count: int :ivar inquiry_validation: Inquiry validation such as permissions and other backup validations. :vartype inquiry_validation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.InquiryValidation """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'item_count': {'key': 'itemCount', 'type': 'long'}, - 'inquiry_validation': {'key': 'inquiryValidation', 'type': 'InquiryValidation'}, + "type": {"key": "type", "type": "str"}, + "item_count": {"key": "itemCount", "type": "int"}, + "inquiry_validation": {"key": "inquiryValidation", "type": "InquiryValidation"}, } def __init__( @@ -19759,20 +20953,20 @@ def __init__( *, type: Optional[str] = None, item_count: Optional[int] = None, - inquiry_validation: Optional["InquiryValidation"] = None, + inquiry_validation: Optional["_models.InquiryValidation"] = None, **kwargs ): """ :keyword type: Type of the Workload such as SQL, Oracle etc. :paramtype type: str :keyword item_count: Contains the protectable item Count inside this Container. - :paramtype item_count: long + :paramtype item_count: int :keyword inquiry_validation: Inquiry validation such as permissions and other backup validations. :paramtype inquiry_validation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.InquiryValidation """ - super(WorkloadInquiryDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.item_count = item_count self.inquiry_validation = inquiry_validation @@ -19792,7 +20986,7 @@ class WorkloadItemResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -19801,19 +20995,19 @@ class WorkloadItemResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'WorkloadItem'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "WorkloadItem"}, } def __init__( @@ -19822,20 +21016,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["WorkloadItem"] = None, + properties: Optional["_models.WorkloadItem"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: WorkloadItemResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItem """ - super(WorkloadItemResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -19851,16 +21045,12 @@ class WorkloadItemResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[WorkloadItemResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[WorkloadItemResource]"}, } def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["WorkloadItemResource"]] = None, - **kwargs + self, *, next_link: Optional[str] = None, value: Optional[List["_models.WorkloadItemResource"]] = None, **kwargs ): """ :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next @@ -19870,7 +21060,7 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResource] """ - super(WorkloadItemResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value @@ -19888,7 +21078,7 @@ class WorkloadProtectableItemResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -19898,19 +21088,19 @@ class WorkloadProtectableItemResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'WorkloadProtectableItem'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "WorkloadProtectableItem"}, } def __init__( @@ -19919,13 +21109,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["WorkloadProtectableItem"] = None, + properties: Optional["_models.WorkloadProtectableItem"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -19933,7 +21123,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItem """ - super(WorkloadProtectableItemResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -19949,15 +21139,15 @@ class WorkloadProtectableItemResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[WorkloadProtectableItemResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[WorkloadProtectableItemResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["WorkloadProtectableItemResource"]] = None, + value: Optional[List["_models.WorkloadProtectableItemResource"]] = None, **kwargs ): """ @@ -19968,15 +21158,15 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResource] """ - super(WorkloadProtectableItemResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class YearlyRetentionSchedule(msrest.serialization.Model): +class YearlyRetentionSchedule(_serialization.Model): """Yearly retention schedule. :ivar retention_schedule_format_type: Retention schedule format for yearly retention policy. - Possible values include: "Invalid", "Daily", "Weekly". + Known values are: "Invalid", "Daily", and "Weekly". :vartype retention_schedule_format_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionScheduleFormat :ivar months_of_year: List of months of year of yearly retention policy. @@ -19996,28 +21186,28 @@ class YearlyRetentionSchedule(msrest.serialization.Model): """ _attribute_map = { - 'retention_schedule_format_type': {'key': 'retentionScheduleFormatType', 'type': 'str'}, - 'months_of_year': {'key': 'monthsOfYear', 'type': '[str]'}, - 'retention_schedule_daily': {'key': 'retentionScheduleDaily', 'type': 'DailyRetentionFormat'}, - 'retention_schedule_weekly': {'key': 'retentionScheduleWeekly', 'type': 'WeeklyRetentionFormat'}, - 'retention_times': {'key': 'retentionTimes', 'type': '[iso-8601]'}, - 'retention_duration': {'key': 'retentionDuration', 'type': 'RetentionDuration'}, + "retention_schedule_format_type": {"key": "retentionScheduleFormatType", "type": "str"}, + "months_of_year": {"key": "monthsOfYear", "type": "[str]"}, + "retention_schedule_daily": {"key": "retentionScheduleDaily", "type": "DailyRetentionFormat"}, + "retention_schedule_weekly": {"key": "retentionScheduleWeekly", "type": "WeeklyRetentionFormat"}, + "retention_times": {"key": "retentionTimes", "type": "[iso-8601]"}, + "retention_duration": {"key": "retentionDuration", "type": "RetentionDuration"}, } def __init__( self, *, - retention_schedule_format_type: Optional[Union[str, "RetentionScheduleFormat"]] = None, - months_of_year: Optional[List[Union[str, "MonthOfYear"]]] = None, - retention_schedule_daily: Optional["DailyRetentionFormat"] = None, - retention_schedule_weekly: Optional["WeeklyRetentionFormat"] = None, + retention_schedule_format_type: Optional[Union[str, "_models.RetentionScheduleFormat"]] = None, + months_of_year: Optional[List[Union[str, "_models.MonthOfYear"]]] = None, + retention_schedule_daily: Optional["_models.DailyRetentionFormat"] = None, + retention_schedule_weekly: Optional["_models.WeeklyRetentionFormat"] = None, retention_times: Optional[List[datetime.datetime]] = None, - retention_duration: Optional["RetentionDuration"] = None, + retention_duration: Optional["_models.RetentionDuration"] = None, **kwargs ): """ :keyword retention_schedule_format_type: Retention schedule format for yearly retention policy. - Possible values include: "Invalid", "Daily", "Weekly". + Known values are: "Invalid", "Daily", and "Weekly". :paramtype retention_schedule_format_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionScheduleFormat :keyword months_of_year: List of months of year of yearly retention policy. @@ -20035,7 +21225,7 @@ def __init__( :paramtype retention_duration: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDuration """ - super(YearlyRetentionSchedule, self).__init__(**kwargs) + super().__init__(**kwargs) self.retention_schedule_format_type = retention_schedule_format_type self.months_of_year = months_of_year self.retention_schedule_daily = retention_schedule_daily diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py index 9786bcee91644..ab87b657e3cf0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py @@ -7,36 +7,34 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AcquireStorageAccountLock(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Whether storage account lock is to be acquired for this container or not. - """ +class AcquireStorageAccountLock(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether storage account lock is to be acquired for this container or not.""" ACQUIRE = "Acquire" NOT_ACQUIRE = "NotAcquire" -class AzureFileShareType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """File Share type XSync or XSMB. - """ + +class AzureFileShareType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """File Share type XSync or XSMB.""" INVALID = "Invalid" XSMB = "XSMB" X_SYNC = "XSync" -class BackupEngineType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of the backup engine. - """ + +class BackupEngineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the backup engine.""" INVALID = "Invalid" DPM_BACKUP_ENGINE = "DpmBackupEngine" AZURE_BACKUP_SERVER_ENGINE = "AzureBackupServerEngine" -class BackupItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of backup items associated with this container. - """ + +class BackupItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of backup items associated with this container.""" INVALID = "Invalid" VM = "VM" @@ -53,10 +51,11 @@ class BackupItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AZURE_FILE_SHARE = "AzureFileShare" SAP_HANA_DATABASE = "SAPHanaDatabase" SAP_ASE_DATABASE = "SAPAseDatabase" + SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" -class BackupManagementType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup management type to execute the current job. - """ + +class BackupManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup management type to execute the current job.""" INVALID = "Invalid" AZURE_IAAS_VM = "AzureIaasVM" @@ -68,9 +67,9 @@ class BackupManagementType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AZURE_WORKLOAD = "AzureWorkload" DEFAULT_BACKUP = "DefaultBackup" -class BackupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of backup, viz. Full, Differential, Log or CopyOnlyFull - """ + +class BackupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of backup, viz. Full, Differential, Log or CopyOnlyFull.""" INVALID = "Invalid" FULL = "Full" @@ -78,10 +77,12 @@ class BackupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOG = "Log" COPY_ONLY_FULL = "CopyOnlyFull" INCREMENTAL = "Incremental" + SNAPSHOT_FULL = "SnapshotFull" + SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" -class ContainerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of container for filter - """ + +class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of container for filter.""" INVALID = "Invalid" UNKNOWN = "Unknown" @@ -98,13 +99,11 @@ class ContainerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SQLAG_WORK_LOAD_CONTAINER = "SQLAGWorkLoadContainer" STORAGE_CONTAINER = "StorageContainer" GENERIC_CONTAINER = "GenericContainer" - MICROSOFT_CLASSIC_COMPUTE_VIRTUAL_MACHINES = "Microsoft.ClassicCompute/virtualMachines" - MICROSOFT_COMPUTE_VIRTUAL_MACHINES = "Microsoft.Compute/virtualMachines" - AZURE_WORKLOAD_CONTAINER = "AzureWorkloadContainer" + HANA_HSR_CONTAINER = "HanaHSRContainer" -class CopyOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Options to resolve copy conflicts. - """ + +class CopyOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Options to resolve copy conflicts.""" INVALID = "Invalid" CREATE_COPY = "CreateCopy" @@ -112,7 +111,8 @@ class CopyOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE = "Overwrite" FAIL_ON_CONFLICT = "FailOnConflict" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Create mode to indicate recovery of existing soft deleted data source or creation of new data source. """ @@ -121,17 +121,17 @@ class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" RECOVER = "Recover" -class DataMoveLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """DataMove Level - """ + +class DataMoveLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataMove Level.""" INVALID = "Invalid" VAULT = "Vault" CONTAINER = "Container" -class DataSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of workload this item represents. - """ + +class DataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of workload this item represents.""" INVALID = "Invalid" VM = "VM" @@ -148,8 +148,11 @@ class DataSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AZURE_FILE_SHARE = "AzureFileShare" SAP_HANA_DATABASE = "SAPHanaDatabase" SAP_ASE_DATABASE = "SAPAseDatabase" + SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" + -class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DayOfWeek.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -159,60 +162,60 @@ class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DedupState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Vault Dedup state - """ + +class DedupState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Vault Dedup state.""" INVALID = "Invalid" ENABLED = "Enabled" DISABLED = "Disabled" -class EncryptionAtRestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Encryption At Rest Type - """ + +class EncryptionAtRestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Encryption At Rest Type.""" INVALID = "Invalid" MICROSOFT_MANAGED = "MicrosoftManaged" CUSTOMER_MANAGED = "CustomerManaged" -class EnhancedSecurityState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enabled or Disabled. - """ + +class EnhancedSecurityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enabled or Disabled.""" INVALID = "Invalid" ENABLED = "Enabled" DISABLED = "Disabled" -class FabricName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Specifies the fabric name - Azure or AD - """ + +class FabricName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the fabric name - Azure or AD.""" INVALID = "Invalid" AZURE = "Azure" -class HealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Health State for the backed up item. - """ + +class HealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Health State for the backed up item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" -class HealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Health status of protected item. - """ + +class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Health status of protected item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" -class HttpStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """HTTP Status Code of the operation. - """ - CONTINUE_ENUM = "Continue" +class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """HTTP Status Code of the operation.""" + + CONTINUE = "Continue" SWITCHING_PROTOCOLS = "SwitchingProtocols" OK = "OK" CREATED = "Created" @@ -260,37 +263,41 @@ class HttpStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GATEWAY_TIMEOUT = "GatewayTimeout" HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" -class IAASVMPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class IAASVMPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IAASVMPolicyType.""" INVALID = "Invalid" V1 = "V1" V2 = "V2" -class InfrastructureEncryptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class InfrastructureEncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """InfrastructureEncryptionState.""" INVALID = "Invalid" DISABLED = "Disabled" ENABLED = "Enabled" -class InquiryStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Status of protectable item, i.e. InProgress,Succeeded,Failed - """ + +class InquiryStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of protectable item, i.e. InProgress,Succeeded,Failed.""" INVALID = "Invalid" SUCCESS = "Success" FAILED = "Failed" -class IntentItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of workload this item represents - """ + +class IntentItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of workload this item represents.""" INVALID = "Invalid" SQL_INSTANCE = "SQLInstance" SQL_AVAILABILITY_GROUP_CONTAINER = "SQLAvailabilityGroupContainer" -class JobOperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of operation. - """ + +class JobOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of operation.""" INVALID = "Invalid" REGISTER = "Register" @@ -304,9 +311,9 @@ class JobOperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNDELETE = "Undelete" UPDATE_CUSTOMER_MANAGED_KEY = "UpdateCustomerManagedKey" -class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Status of the job. - """ + +class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the job.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -316,22 +323,26 @@ class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CANCELLED = "Cancelled" CANCELLING = "Cancelling" -class JobSupportedAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JobSupportedAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JobSupportedAction.""" INVALID = "Invalid" CANCELLABLE = "Cancellable" RETRIABLE = "Retriable" -class LastBackupStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Last backup operation status. Possible values: Healthy, Unhealthy. - """ + +class LastBackupStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Last backup operation status. Possible values: Healthy, Unhealthy.""" INVALID = "Invalid" HEALTHY = "Healthy" UNHEALTHY = "Unhealthy" IR_PENDING = "IRPending" -class LastUpdateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class LastUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LastUpdateStatus.""" INVALID = "Invalid" NOT_ENABLED = "NotEnabled" @@ -342,9 +353,9 @@ class LastUpdateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INITIALIZED = "Initialized" FIRST_INITIALIZATION = "FirstInitialization" -class MabServerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Server type of MAB container. - """ + +class MabServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Server type of MAB container.""" INVALID = "Invalid" UNKNOWN = "Unknown" @@ -362,7 +373,9 @@ class MabServerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STORAGE_CONTAINER = "StorageContainer" GENERIC_CONTAINER = "GenericContainer" -class MonthOfYear(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class MonthOfYear(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonthOfYear.""" INVALID = "Invalid" JANUARY = "January" @@ -378,9 +391,9 @@ class MonthOfYear(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NOVEMBER = "November" DECEMBER = "December" -class OperationStatusValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Operation status. - """ + +class OperationStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operation status.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -388,25 +401,25 @@ class OperationStatusValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class OperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Re-Do Operation - """ + +class OperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Re-Do Operation.""" INVALID = "Invalid" REGISTER = "Register" REREGISTER = "Reregister" -class OverwriteOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Can Overwrite if Target DataBase already exists - """ + +class OverwriteOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Can Overwrite if Target DataBase already exists.""" INVALID = "Invalid" FAIL_ON_CONFLICT = "FailOnConflict" OVERWRITE = "Overwrite" -class PolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of backup policy type - """ + +class PolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of backup policy type.""" INVALID = "Invalid" FULL = "Full" @@ -414,29 +427,59 @@ class PolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOG = "Log" COPY_ONLY_FULL = "CopyOnlyFull" INCREMENTAL = "Incremental" + SNAPSHOT_FULL = "SnapshotFull" + SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" -class PrivateEndpointConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets or sets the status - """ + +class PrivateEndpointConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProtectedItemHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Health status of the backup item, evaluated based on last heartbeat received + +class ProtectableContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the container. The value of this property for + + + #. Compute Azure VM is Microsoft.Compute/virtualMachines + #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines. """ + INVALID = "Invalid" + UNKNOWN = "Unknown" + IAAS_VM_CONTAINER = "IaasVMContainer" + IAAS_VM_SERVICE_CONTAINER = "IaasVMServiceContainer" + DPM_CONTAINER = "DPMContainer" + AZURE_BACKUP_SERVER_CONTAINER = "AzureBackupServerContainer" + MAB_CONTAINER = "MABContainer" + CLUSTER = "Cluster" + AZURE_SQL_CONTAINER = "AzureSqlContainer" + WINDOWS = "Windows" + V_CENTER = "VCenter" + VM_APP_CONTAINER = "VMAppContainer" + SQLAG_WORK_LOAD_CONTAINER = "SQLAGWorkLoadContainer" + STORAGE_CONTAINER = "StorageContainer" + GENERIC_CONTAINER = "GenericContainer" + MICROSOFT_CLASSIC_COMPUTE_VIRTUAL_MACHINES = "Microsoft.ClassicCompute/virtualMachines" + MICROSOFT_COMPUTE_VIRTUAL_MACHINES = "Microsoft.Compute/virtualMachines" + AZURE_WORKLOAD_CONTAINER = "AzureWorkloadContainer" + + +class ProtectedItemHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Health status of the backup item, evaluated based on last heartbeat received.""" + INVALID = "Invalid" HEALTHY = "Healthy" UNHEALTHY = "Unhealthy" NOT_REACHABLE = "NotReachable" IR_PENDING = "IRPending" -class ProtectedItemState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup state of the backed up item. - """ + +class ProtectedItemState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup state of the backed up item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -445,9 +488,9 @@ class ProtectedItemState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" -class ProtectionIntentItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """backup protectionIntent type. - """ + +class ProtectionIntentItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """backup protectionIntent type.""" INVALID = "Invalid" AZURE_RESOURCE_ITEM = "AzureResourceItem" @@ -456,9 +499,9 @@ class ProtectionIntentItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_WORKLOAD_AUTO_PROTECTION_INTENT = "AzureWorkloadAutoProtectionIntent" AZURE_WORKLOAD_SQL_AUTO_PROTECTION_INTENT = "AzureWorkloadSQLAutoProtectionIntent" -class ProtectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup state of this backup item. - """ + +class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup state of this backup item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -467,9 +510,9 @@ class ProtectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" -class ProtectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Specifies whether the container is registered or not - """ + +class ProtectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies whether the container is registered or not.""" INVALID = "Invalid" NOT_PROTECTED = "NotProtected" @@ -477,26 +520,26 @@ class ProtectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PROTECTED = "Protected" PROTECTION_FAILED = "ProtectionFailed" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets or sets provisioning state of the private endpoint connection - """ + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets provisioning state of the private endpoint connection.""" SUCCEEDED = "Succeeded" DELETING = "Deleting" FAILED = "Failed" PENDING = "Pending" -class RecoveryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Defines whether the current recovery mode is file restore or database restore - """ + +class RecoveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines whether the current recovery mode is file restore or database restore.""" INVALID = "Invalid" FILE_RECOVERY = "FileRecovery" WORKLOAD_RECOVERY = "WorkloadRecovery" -class RecoveryPointTierStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Recovery point tier status. - """ + +class RecoveryPointTierStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recovery point tier status.""" INVALID = "Invalid" VALID = "Valid" @@ -504,18 +547,18 @@ class RecoveryPointTierStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) DELETED = "Deleted" REHYDRATED = "Rehydrated" -class RecoveryPointTierType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Recovery point tier type. - """ + +class RecoveryPointTierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recovery point tier type.""" INVALID = "Invalid" INSTANT_RP = "InstantRP" HARDENED_RP = "HardenedRP" ARCHIVED_RP = "ArchivedRP" -class RecoveryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of this recovery. - """ + +class RecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of this recovery.""" INVALID = "Invalid" ORIGINAL_LOCATION = "OriginalLocation" @@ -523,16 +566,16 @@ class RecoveryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RESTORE_DISKS = "RestoreDisks" OFFLINE = "Offline" -class RehydrationPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Rehydration Priority - """ + +class RehydrationPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Rehydration Priority.""" STANDARD = "Standard" HIGH = "High" -class ResourceHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource Health Status - """ + +class ResourceHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource Health Status.""" HEALTHY = "Healthy" TRANSIENT_DEGRADED = "TransientDegraded" @@ -541,9 +584,9 @@ class ResourceHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PERSISTENT_UNHEALTHY = "PersistentUnhealthy" INVALID = "Invalid" -class RestorePointQueryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """RestorePoint type - """ + +class RestorePointQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RestorePoint type.""" INVALID = "Invalid" FULL = "Full" @@ -552,28 +595,32 @@ class RestorePointQueryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FULL_AND_DIFFERENTIAL = "FullAndDifferential" ALL = "All" INCREMENTAL = "Incremental" + SNAPSHOT_FULL = "SnapshotFull" + SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" -class RestorePointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of restore point - """ + +class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of restore point.""" INVALID = "Invalid" FULL = "Full" LOG = "Log" DIFFERENTIAL = "Differential" INCREMENTAL = "Incremental" + SNAPSHOT_FULL = "SnapshotFull" + SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" -class RestoreRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Restore Type (FullShareRestore or ItemLevelRestore) - """ + +class RestoreRequestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Restore Type (FullShareRestore or ItemLevelRestore).""" INVALID = "Invalid" FULL_SHARE_RESTORE = "FullShareRestore" ITEM_LEVEL_RESTORE = "ItemLevelRestore" -class RetentionDurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Retention duration type of retention policy. - """ + +class RetentionDurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Retention duration type of retention policy.""" INVALID = "Invalid" DAYS = "Days" @@ -581,42 +628,42 @@ class RetentionDurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MONTHS = "Months" YEARS = "Years" -class RetentionScheduleFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Retention schedule format type for monthly retention policy. - """ + +class RetentionScheduleFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Retention schedule format type for monthly retention policy.""" INVALID = "Invalid" DAILY = "Daily" WEEKLY = "Weekly" -class ScheduleRunType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Frequency of the schedule operation of this policy. - """ + +class ScheduleRunType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Frequency of the schedule operation of this policy.""" INVALID = "Invalid" DAILY = "Daily" WEEKLY = "Weekly" HOURLY = "Hourly" -class SoftDeleteFeatureState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Soft Delete feature state - """ + +class SoftDeleteFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Soft Delete feature state.""" INVALID = "Invalid" ENABLED = "Enabled" DISABLED = "Disabled" -class SQLDataDirectoryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of data directory mapping - """ + +class SQLDataDirectoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of data directory mapping.""" INVALID = "Invalid" DATA = "Data" LOG = "Log" -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Storage type - """ + +class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Storage type.""" INVALID = "Invalid" GEO_REDUNDANT = "GeoRedundant" @@ -624,7 +671,8 @@ class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ZONE_REDUNDANT = "ZoneRedundant" READ_ACCESS_GEO_ZONE_REDUNDANT = "ReadAccessGeoZoneRedundant" -class StorageTypeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class StorageTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. """ @@ -633,9 +681,9 @@ class StorageTypeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOCKED = "Locked" UNLOCKED = "Unlocked" -class SupportStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Support status of feature - """ + +class SupportStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Support status of feature.""" INVALID = "Invalid" SUPPORTED = "Supported" @@ -643,17 +691,33 @@ class SupportStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT_ON = "DefaultON" NOT_SUPPORTED = "NotSupported" -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup management type for this container. + +class TieringMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tiering Mode to control automatic tiering of recovery points. Supported values are: + + + #. TierRecommended: Tier all recovery points recommended to be tiered + #. TierAfter: Tier all recovery points after a fixed period, as specified in duration + + durationType below. + #. DoNotTier: Do not tier any recovery points. """ + INVALID = "Invalid" + TIER_RECOMMENDED = "TierRecommended" + TIER_AFTER = "TierAfter" + DO_NOT_TIER = "DoNotTier" + + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup management type for this container.""" + INVALID = "Invalid" BACKUP_PROTECTED_ITEM_COUNT_SUMMARY = "BackupProtectedItemCountSummary" BACKUP_PROTECTION_CONTAINER_COUNT_SUMMARY = "BackupProtectionContainerCountSummary" -class UsagesUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Unit of the usage. - """ + +class UsagesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Unit of the usage.""" COUNT = "Count" BYTES = "Bytes" @@ -662,15 +726,17 @@ class UsagesUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COUNT_PER_SECOND = "CountPerSecond" BYTES_PER_SECOND = "BytesPerSecond" -class ValidationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Validation Status - """ + +class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Validation Status.""" INVALID = "Invalid" SUCCEEDED = "Succeeded" FAILED = "Failed" -class WeekOfMonth(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class WeekOfMonth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WeekOfMonth.""" FIRST = "First" SECOND = "Second" @@ -679,9 +745,9 @@ class WeekOfMonth(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LAST = "Last" INVALID = "Invalid" -class WorkloadItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Workload item type of the item for which intent is to be set - """ + +class WorkloadItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Workload item type of the item for which intent is to be set.""" INVALID = "Invalid" SQL_INSTANCE = "SQLInstance" @@ -690,10 +756,11 @@ class WorkloadItemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SAP_HANA_DATABASE = "SAPHanaDatabase" SAP_ASE_SYSTEM = "SAPAseSystem" SAP_ASE_DATABASE = "SAPAseDatabase" + SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" -class WorkloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of workload for the backup management - """ + +class WorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of workload for the backup management.""" INVALID = "Invalid" VM = "VM" @@ -710,10 +777,11 @@ class WorkloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AZURE_FILE_SHARE = "AzureFileShare" SAP_HANA_DATABASE = "SAPHanaDatabase" SAP_ASE_DATABASE = "SAPAseDatabase" + SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" -class XcoolState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Vault x-cool state - """ + +class XcoolState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Vault x-cool state.""" INVALID = "Invalid" ENABLED = "Enabled" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py index 262a069be4dce..b99ca58fa0746 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py @@ -38,7 +38,9 @@ from ._validate_operation_results_operations import ValidateOperationResultsOperations from ._validate_operation_statuses_operations import ValidateOperationStatusesOperations from ._backup_engines_operations import BackupEnginesOperations -from ._protection_container_refresh_operation_results_operations import ProtectionContainerRefreshOperationResultsOperations +from ._protection_container_refresh_operation_results_operations import ( + ProtectionContainerRefreshOperationResultsOperations, +) from ._protectable_containers_operations import ProtectableContainersOperations from ._protection_containers_operations import ProtectionContainersOperations from ._backup_workload_items_operations import BackupWorkloadItemsOperations @@ -56,54 +58,60 @@ from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations from ._resource_guard_proxy_operations import ResourceGuardProxyOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'BackupResourceStorageConfigsNonCRROperations', - 'ProtectionIntentOperations', - 'BackupStatusOperations', - 'FeatureSupportOperations', - 'BackupProtectionIntentOperations', - 'BackupUsageSummariesOperations', - 'Operations', - 'BackupResourceVaultConfigsOperations', - 'BackupResourceEncryptionConfigsOperations', - 'PrivateEndpointConnectionOperations', - 'PrivateEndpointOperations', - 'RecoveryServicesBackupClientOperationsMixin', - 'BMSPrepareDataMoveOperationResultOperations', - 'ProtectedItemsOperations', - 'ProtectedItemOperationResultsOperations', - 'RecoveryPointsOperations', - 'RestoresOperations', - 'BackupPoliciesOperations', - 'ProtectionPoliciesOperations', - 'ProtectionPolicyOperationResultsOperations', - 'BackupJobsOperations', - 'JobDetailsOperations', - 'JobCancellationsOperations', - 'JobOperationResultsOperations', - 'ExportJobsOperationResultsOperations', - 'JobsOperations', - 'BackupProtectedItemsOperations', - 'OperationOperations', - 'ValidateOperationOperations', - 'ValidateOperationResultsOperations', - 'ValidateOperationStatusesOperations', - 'BackupEnginesOperations', - 'ProtectionContainerRefreshOperationResultsOperations', - 'ProtectableContainersOperations', - 'ProtectionContainersOperations', - 'BackupWorkloadItemsOperations', - 'ProtectionContainerOperationResultsOperations', - 'BackupsOperations', - 'ProtectedItemOperationStatusesOperations', - 'ItemLevelRecoveryConnectionsOperations', - 'BackupOperationResultsOperations', - 'BackupOperationStatusesOperations', - 'ProtectionPolicyOperationStatusesOperations', - 'BackupProtectableItemsOperations', - 'BackupProtectionContainersOperations', - 'SecurityPINsOperations', - 'RecoveryPointsRecommendedForMoveOperations', - 'ResourceGuardProxiesOperations', - 'ResourceGuardProxyOperations', + "BackupResourceStorageConfigsNonCRROperations", + "ProtectionIntentOperations", + "BackupStatusOperations", + "FeatureSupportOperations", + "BackupProtectionIntentOperations", + "BackupUsageSummariesOperations", + "Operations", + "BackupResourceVaultConfigsOperations", + "BackupResourceEncryptionConfigsOperations", + "PrivateEndpointConnectionOperations", + "PrivateEndpointOperations", + "RecoveryServicesBackupClientOperationsMixin", + "BMSPrepareDataMoveOperationResultOperations", + "ProtectedItemsOperations", + "ProtectedItemOperationResultsOperations", + "RecoveryPointsOperations", + "RestoresOperations", + "BackupPoliciesOperations", + "ProtectionPoliciesOperations", + "ProtectionPolicyOperationResultsOperations", + "BackupJobsOperations", + "JobDetailsOperations", + "JobCancellationsOperations", + "JobOperationResultsOperations", + "ExportJobsOperationResultsOperations", + "JobsOperations", + "BackupProtectedItemsOperations", + "OperationOperations", + "ValidateOperationOperations", + "ValidateOperationResultsOperations", + "ValidateOperationStatusesOperations", + "BackupEnginesOperations", + "ProtectionContainerRefreshOperationResultsOperations", + "ProtectableContainersOperations", + "ProtectionContainersOperations", + "BackupWorkloadItemsOperations", + "ProtectionContainerOperationResultsOperations", + "BackupsOperations", + "ProtectedItemOperationStatusesOperations", + "ItemLevelRecoveryConnectionsOperations", + "BackupOperationResultsOperations", + "BackupOperationStatusesOperations", + "ProtectionPolicyOperationStatusesOperations", + "BackupProtectableItemsOperations", + "BackupProtectionContainersOperations", + "SecurityPINsOperations", + "RecoveryPointsRecommendedForMoveOperations", + "ResourceGuardProxiesOperations", + "ResourceGuardProxyOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py index cb18c7fb32955..6d7c6ed1f8aa6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,105 +44,99 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, backup_engine_name: str, + subscription_id: str, *, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "backupEngineName": _SERIALIZER.url("backup_engine_name", backup_engine_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "backupEngineName": _SERIALIZER.url("backup_engine_name", backup_engine_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupEnginesOperations(object): - """BackupEnginesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupEnginesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_engines` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -143,61 +146,60 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.BackupEngineBaseResourceList"]: + ) -> Iterable["_models.BackupEngineBaseResource"]: """Backup management servers registered to Recovery Services Vault. Returns a pageable list of servers. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupEngineBaseResourceList or the result of + :return: An iterator like instance of either BackupEngineBaseResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupEngineBaseResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -211,10 +213,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -224,11 +224,9 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore @distributed_trace def get( @@ -239,64 +237,64 @@ def get( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> "_models.BackupEngineBaseResource": + ) -> _models.BackupEngineBaseResource: """Returns backup management server registered to Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param backup_engine_name: Name of the backup management server. + :param backup_engine_name: Name of the backup management server. Required. :type backup_engine_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupEngineBaseResource, or the result of cls(response) + :return: BackupEngineBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupEngineBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, backup_engine_name=backup_engine_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, skip_token=skip_token, - template_url=self.get.metadata['url'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupEngineBaseResource', pipeline_response) + deserialized = self._deserialize("BackupEngineBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py index 31d60c9d4ab33..d30fc7777a4bc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupJobsOperations(object): - """BackupJobsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,59 +103,58 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.JobResourceList"]: + ) -> Iterable["_models.JobResource"]: """Provides a pageable list of jobs. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobResourceList or the result of cls(response) + :return: An iterator like instance of either JobResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -164,10 +168,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -177,8 +179,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py index 979a8dad6b273..34e6df24a7439 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py @@ -8,89 +8,85 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupOperationResultsOperations(object): - """BackupOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any ) -> None: """Provides the status of the delete operations such as deleting backed up item. Once the operation has started, the @@ -100,43 +96,44 @@ def get( # pylint: disable=inconsistent-return-statements argument. OperationID is part of the Location header of the operation response. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: OperationID which represents the operation. + :param operation_id: OperationID which represents the operation. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -146,5 +143,4 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py index 13b5702b85cb0..c716bb630932c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py @@ -8,145 +8,141 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupOperationStatusesOperations(object): - """BackupOperationStatusesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Fetches the status of an operation such as triggering a backup, restore. The status can be in progress, completed or failed. You can refer to the OperationStatus enum for all the possible states of an operation. Some operations create jobs. This method returns the list of jobs when the operation is complete. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: OperationID which represents the operation. + :param operation_id: OperationID which represents the operation. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py index 81d4aa22d6495..34965e196c011 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py @@ -7,145 +7,141 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - **kwargs: Any + vault_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, - vault_name: str, - resource_group_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.ProtectionPolicyResourceList"]: + self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ProtectionPolicyResource"]: """Lists of backup policies associated with Recovery Services Vault. API provides pagination parameters to fetch scoped results. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionPolicyResourceList or the result of + :return: An iterator like instance of either ProtectionPolicyResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -159,10 +155,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -172,8 +166,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py index 290f4679a2c35..faf7c74a8ee55 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupProtectableItemsOperations(object): - """BackupProtectableItemsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupProtectableItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_protectable_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,62 +103,61 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.WorkloadProtectableItemResourceList"]: + ) -> Iterable["_models.WorkloadProtectableItemResource"]: """Provides a pageable list of protectable objects within your subscription according to the query filter and the pagination parameters. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadProtectableItemResourceList or the result - of cls(response) + :return: An iterator like instance of either WorkloadProtectableItemResource or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadProtectableItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadProtectableItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -167,10 +171,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -180,8 +182,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py index 0ddf83697024c..0e681e70d4a38 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupProtectedItemsOperations(object): - """BackupProtectedItemsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupProtectedItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_protected_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,60 +103,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ProtectedItemResourceList"]: + ) -> Iterable["_models.ProtectedItemResource"]: """Provides a pageable list of all items that are backed up within a vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectedItemResourceList or the result of + :return: An iterator like instance of either ProtectedItemResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -165,10 +169,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -178,8 +180,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py index 70a1582b08e80..352bb8c09b3b6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py @@ -7,143 +7,139 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - **kwargs: Any + vault_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupProtectionContainersOperations(object): - """BackupProtectionContainersOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_protection_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, - vault_name: str, - resource_group_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.ProtectionContainerResourceList"]: + self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ProtectionContainerResource"]: """Lists the containers registered to Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionContainerResourceList or the result of + :return: An iterator like instance of either ProtectionContainerResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -157,10 +153,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -170,8 +164,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py index 5476e94747ef8..b2cedb51ecdfa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupProtectionIntentOperations(object): - """BackupProtectionIntentOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupProtectionIntentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_protection_intent` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,60 +103,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ProtectionIntentResourceList"]: + ) -> Iterable["_models.ProtectionIntentResource"]: """Provides a pageable list of all intents that are present within a vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectionIntentResourceList or the result of + :return: An iterator like instance of either ProtectionIntentResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -165,10 +169,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -178,8 +180,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore + list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py index 7f853b334f59b..6a6cb8db0479b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py @@ -6,171 +6,155 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - accept = "application/json" +def build_get_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupResourceEncryptionConfigsOperations(object): - """BackupResourceEncryptionConfigsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupResourceEncryptionConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_resource_encryption_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceEncryptionConfigExtendedResource": + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> _models.BackupResourceEncryptionConfigExtendedResource: """Fetches Vault Encryption config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceEncryptionConfigExtendedResource, or the result of cls(response) + :return: BackupResourceEncryptionConfigExtendedResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigExtendedResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceEncryptionConfigExtendedResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,49 +162,117 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceEncryptionConfigExtendedResource', pipeline_response) + deserialized = self._deserialize("BackupResourceEncryptionConfigExtendedResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + + @overload + def update( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceEncryptionConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates Vault encryption config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault encryption input config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates Vault encryption config. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault encryption input config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceEncryptionConfigResource", + parameters: Union[_models.BackupResourceEncryptionConfigResource, IO], **kwargs: Any ) -> None: """Updates Vault encryption config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault encryption input config request. + :param parameters: Vault encryption input config request. Is either a model type or a IO type. + Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceEncryptionConfigResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'BackupResourceEncryptionConfigResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceEncryptionConfigResource") request = build_update_request( vault_name=vault_name, @@ -229,16 +281,18 @@ def update( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -249,5 +303,4 @@ def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py index a8e8938f0aef2..3ec7ee805d852 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -6,214 +6,184 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - accept = "application/json" +def build_get_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_patch_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_patch_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupResourceStorageConfigsNonCRROperations(object): - """BackupResourceStorageConfigsNonCRROperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupResourceStorageConfigsNonCRROperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_resource_storage_configs_non_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _models.BackupResourceConfigResource: """Fetches resource storage config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,49 +191,115 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + @overload + def update( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + ) -> _models.BackupResourceConfigResource: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_update_request( vault_name=vault_name, @@ -272,16 +308,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -289,49 +327,115 @@ def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + + @overload + def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any ) -> None: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_patch_request( vault_name=vault_name, @@ -340,16 +444,18 @@ def patch( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.patch.metadata['url'], + content=_content, + template_url=self.patch.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -360,5 +466,4 @@ def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore - + patch.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py index 9ca1d821533f2..8f07ff921db78 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py @@ -6,214 +6,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - accept = "application/json" +def build_get_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_put_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_put_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupResourceVaultConfigsOperations(object): - """BackupResourceVaultConfigsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupResourceVaultConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_resource_vault_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceVaultConfigResource": + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: """Fetches resource vault config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceVaultConfigResource, or the result of cls(response) + :return: BackupResourceVaultConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceVaultConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,49 +193,115 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceVaultConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + @overload + def update( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceVaultConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceVaultConfigResource", + parameters: Union[_models.BackupResourceVaultConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceVaultConfigResource": + ) -> _models.BackupResourceVaultConfigResource: """Updates vault security config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource config request. + :param parameters: resource config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceVaultConfigResource, or the result of cls(response) + :return: BackupResourceVaultConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceVaultConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] - _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceVaultConfigResource") request = build_update_request( vault_name=vault_name, @@ -272,16 +310,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -289,49 +329,115 @@ def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceVaultConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + @overload + def put( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceVaultConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceVaultConfigResource: + """Updates vault security config. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceVaultConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def put( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceVaultConfigResource", + parameters: Union[_models.BackupResourceVaultConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceVaultConfigResource": + ) -> _models.BackupResourceVaultConfigResource: """Updates vault security config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource config request. + :param parameters: resource config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceVaultConfigResource, or the result of cls(response) + :return: BackupResourceVaultConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceVaultConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] - _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceVaultConfigResource") request = build_put_request( vault_name=vault_name, @@ -340,16 +446,18 @@ def put( api_version=api_version, content_type=content_type, json=_json, - template_url=self.put.metadata['url'], + content=_content, + template_url=self.put.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,12 +465,11 @@ def put( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceVaultConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceVaultConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore - + put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py index 1e026c923cb21..51c427ed6f4a8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py @@ -6,119 +6,169 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - azure_region: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + +def build_get_request(azure_region: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupStatusOperations(object): - """BackupStatusOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def get( self, azure_region: str, - parameters: "_models.BackupStatusRequest", + parameters: _models.BackupStatusRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.BackupStatusResponse": + ) -> _models.BackupStatusResponse: """Get the container backup status. Get the container backup status. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Container Backup Status Request. + :param parameters: Container Backup Status Request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.BackupStatusResponse: + """Get the container backup status. + + Get the container backup status. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Container Backup Status Request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get( + self, azure_region: str, parameters: Union[_models.BackupStatusRequest, IO], **kwargs: Any + ) -> _models.BackupStatusResponse: + """Get the container backup status. + + Get the container backup status. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Container Backup Status Request. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupStatusResponse, or the result of cls(response) + :return: BackupStatusResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupStatusResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStatusResponse] - _json = self._serialize.body(parameters, 'BackupStatusRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupStatusRequest") request = build_get_request( azure_region=azure_region, @@ -126,28 +176,29 @@ def get( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get.metadata['url'], + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupStatusResponse', pipeline_response) + deserialized = self._deserialize("BackupStatusResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore - + get.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py index c390b6fad1592..55ae9f3252936 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupUsageSummariesOperations(object): - """BackupUsageSummariesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupUsageSummariesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_usage_summaries` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,60 +103,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.BackupManagementUsageList"]: + ) -> Iterable["_models.BackupManagementUsage"]: """Fetches the backup management usage summaries of the vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupManagementUsageList or the result of + :return: An iterator like instance of either BackupManagementUsage or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsageList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -165,10 +169,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -178,8 +180,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py index a7f78952cd917..c114c70c7ff3e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py @@ -7,92 +7,97 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, + subscription_id: str, *, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupWorkloadItemsOperations(object): - """BackupWorkloadItemsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupWorkloadItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backup_workload_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -104,70 +109,67 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.WorkloadItemResourceList"]: + ) -> Iterable["_models.WorkloadItemResource"]: """Provides a pageable list of workload item of a specific container according to the query filter and the pagination parameters. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container. + :param container_name: Name of the container. Required. :type container_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadItemResourceList or the result of + :return: An iterator like instance of either WorkloadItemResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -181,10 +183,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -194,8 +194,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py index 3b866b1647632..f12ad3822417e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py @@ -6,96 +6,172 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_trigger_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupsOperations(object): - """BackupsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`backups` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def trigger( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: _models.BackupRequestResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers backup for specified backed up item. This is an asynchronous operation. To know the + status of the + operation, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Backup item for which backup needs to be triggered. Required. + :type protected_item_name: str + :param parameters: resource backup request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupRequestResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def trigger( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Triggers backup for specified backed up item. This is an asynchronous operation. To know the + status of the + operation, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Backup item for which backup needs to be triggered. Required. + :type protected_item_name: str + :param parameters: resource backup request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def trigger( # pylint: disable=inconsistent-return-statements @@ -105,62 +181,75 @@ def trigger( # pylint: disable=inconsistent-return-statements fabric_name: str, container_name: str, protected_item_name: str, - parameters: "_models.BackupRequestResource", + parameters: Union[_models.BackupRequestResource, IO], **kwargs: Any ) -> None: """Triggers backup for specified backed up item. This is an asynchronous operation. To know the status of the operation, call GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Backup item for which backup needs to be triggered. + :param protected_item_name: Backup item for which backup needs to be triggered. Required. :type protected_item_name: str - :param parameters: resource backup request. + :param parameters: resource backup request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupRequestResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'BackupRequestResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupRequestResource") request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.trigger.metadata['url'], + content=_content, + template_url=self.trigger.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -170,5 +259,4 @@ def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore - + trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py index b0089697cc6f4..faf340eb31400 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py @@ -8,131 +8,128 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BMSPrepareDataMoveOperationResultOperations(object): - """BMSPrepareDataMoveOperationResultOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BMSPrepareDataMoveOperationResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`bms_prepare_data_move_operation_result` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> Optional["_models.VaultStorageConfigOperationResultResponse"]: + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.VaultStorageConfigOperationResultResponse]: """Fetches Operation Result for Prepare Data Move. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultStorageConfigOperationResultResponse, or the result of cls(response) + :return: VaultStorageConfigOperationResultResponse or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.VaultStorageConfigOperationResultResponse or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VaultStorageConfigOperationResultResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -142,12 +139,11 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultStorageConfigOperationResultResponse', pipeline_response) + deserialized = self._deserialize("VaultStorageConfigOperationResultResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py index 8b2f0b43137a9..c9e177f35692d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py @@ -8,132 +8,129 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ExportJobsOperationResultsOperations(object): - """ExportJobsOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ExportJobsOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`export_jobs_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationResultInfoBaseResource": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationResultInfoBaseResource: """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 vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: OperationID which represents the export job. + :param operation_id: OperationID which represents the export job. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResultInfoBaseResource, or the result of cls(response) + :return: OperationResultInfoBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationResultInfoBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultInfoBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultInfoBaseResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -141,15 +138,14 @@ def get( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('OperationResultInfoBaseResource', pipeline_response) + deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('OperationResultInfoBaseResource', pipeline_response) + deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py index 43d9d07d49b7e..63d66a4598d8e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py @@ -6,120 +6,172 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_validate_request( - azure_region: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + +def build_validate_request(azure_region: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class FeatureSupportOperations(object): - """FeatureSupportOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FeatureSupportOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`feature_support` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def validate( self, azure_region: str, - parameters: "_models.FeatureSupportRequest", + parameters: _models.FeatureSupportRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.AzureVMResourceFeatureSupportResponse": + ) -> _models.AzureVMResourceFeatureSupportResponse: """It will validate if given feature with resource properties is supported in service. It will validate if given feature with resource properties is supported in service. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Feature support request object. + :param parameters: Feature support request object. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.FeatureSupportRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AzureVMResourceFeatureSupportResponse, or the result of cls(response) + :return: AzureVMResourceFeatureSupportResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureVMResourceFeatureSupportResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + def validate( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureVMResourceFeatureSupportResponse: + """It will validate if given feature with resource properties is supported in service. - _json = self._serialize.body(parameters, 'FeatureSupportRequest') + It will validate if given feature with resource properties is supported in service. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Feature support request object. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureVMResourceFeatureSupportResponse or the result of cls(response) + :rtype: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate( + self, azure_region: str, parameters: Union[_models.FeatureSupportRequest, IO], **kwargs: Any + ) -> _models.AzureVMResourceFeatureSupportResponse: + """It will validate if given feature with resource properties is supported in service. + + It will validate if given feature with resource properties is supported in service. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Feature support request object. Is either a model type or a IO type. + Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.FeatureSupportRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AzureVMResourceFeatureSupportResponse or the result of cls(response) + :rtype: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AzureVMResourceFeatureSupportResponse] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "FeatureSupportRequest") request = build_validate_request( azure_region=azure_region, @@ -127,28 +179,29 @@ def validate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate.metadata['url'], + content=_content, + template_url=self.validate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AzureVMResourceFeatureSupportResponse', pipeline_response) + deserialized = self._deserialize("AzureVMResourceFeatureSupportResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore - + validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py index e80a7e74e9146..86df196d67ae3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py @@ -6,144 +6,140 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_provision_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, recovery_point_id: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_revoke_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, recovery_point_id: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ItemLevelRecoveryConnectionsOperations(object): - """ItemLevelRecoveryConnectionsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ItemLevelRecoveryConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`item_level_recovery_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def provision( # pylint: disable=inconsistent-return-statements self, vault_name: str, @@ -152,7 +148,9 @@ def provision( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.ILRRequestResource", + parameters: _models.ILRRequestResource, + *, + content_type: str = "application/json", **kwargs: Any ) -> None: """Provisions a script which invokes an iSCSI connection to the backup data. Executing this script @@ -161,60 +159,166 @@ def provision( # pylint: disable=inconsistent-return-statements To know the status of provisioning, call GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up items. + :param fabric_name: Fabric name associated with the backed up items. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up items. + :param container_name: Container name associated with the backed up items. Required. :type container_name: str :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. :type protected_item_name: str :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection will be provisioned - for this backed up data. + for this backed up data. Required. :type recovery_point_id: str - :param parameters: resource ILR request. + :param parameters: resource ILR request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ILRRequestResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + def provision( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Provisions a script which invokes an iSCSI connection to the backup data. Executing this script + opens a file + explorer displaying all the recoverable files and folders. This is an asynchronous operation. + To know the status of + provisioning, call GetProtectedItemOperationResult API. - _json = self._serialize.body(parameters, 'ILRRequestResource') + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection + will be provisioned + for this backed up data. Required. + :type recovery_point_id: str + :param parameters: resource ILR request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def provision( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: Union[_models.ILRRequestResource, IO], + **kwargs: Any + ) -> None: + """Provisions a script which invokes an iSCSI connection to the backup data. Executing this script + opens a file + explorer displaying all the recoverable files and folders. This is an asynchronous operation. + To know the status of + provisioning, call GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection + will be provisioned + for this backed up data. Required. + :type recovery_point_id: str + :param parameters: resource ILR request. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ILRRequestResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ILRRequestResource") request = build_provision_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.provision.metadata['url'], + content=_content, + template_url=self.provision.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -224,8 +328,7 @@ def provision( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - provision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore - + provision.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore @distributed_trace def revoke( # pylint: disable=inconsistent-return-statements @@ -242,54 +345,56 @@ def revoke( # pylint: disable=inconsistent-return-statements a file explorer displaying all recoverable files and folders. This is an asynchronous operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up items. + :param fabric_name: Fabric name associated with the backed up items. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up items. + :param container_name: Container name associated with the backed up items. Required. :type container_name: str :param protected_item_name: Backed up item name whose files/folders are to be restored. + Required. :type protected_item_name: str :param recovery_point_id: Recovery point ID which represents backed up data. iSCSI connection will be revoked for - this backed up data. + this backed up data. Required. :type recovery_point_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_revoke_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revoke.metadata['url'], + template_url=self.revoke.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -299,5 +404,4 @@ def revoke( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revoke.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore - + revoke.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py index 59aec487ea825..0378a2ecc88e5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py @@ -8,130 +8,127 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_trigger_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - job_name: str, - **kwargs: Any + vault_name: str, resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class JobCancellationsOperations(object): - """JobCancellationsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobCancellationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`job_cancellations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def trigger( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - job_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, job_name: str, **kwargs: Any ) -> None: """Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param job_name: Name of the job to cancel. + :param job_name: Name of the job to cancel. Required. :type job_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, job_name=job_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.trigger.metadata['url'], + template_url=self.trigger.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -141,5 +138,4 @@ def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore - + trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py index 8b5d59d54414c..52669f7034b22 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py @@ -8,141 +8,135 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - job_name: str, - **kwargs: Any + vault_name: str, resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class JobDetailsOperations(object): - """JobDetailsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobDetailsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`job_details` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - vault_name: str, - resource_group_name: str, - job_name: str, - **kwargs: Any - ) -> "_models.JobResource": + def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.JobResource: """Gets extended information associated with the job. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param job_name: Name of the job whose details are to be fetched. + :param job_name: Name of the job whose details are to be fetched. Required. :type job_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JobResource, or the result of cls(response) + :return: JobResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, job_name=job_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('JobResource', pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py index 1f6bb053cf149..513b5685ef51d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py @@ -8,135 +8,131 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - job_name: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, job_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "jobName": _SERIALIZER.url("job_name", job_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "jobName": _SERIALIZER.url("job_name", job_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class JobOperationResultsOperations(object): - """JobOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`job_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - job_name: str, - operation_id: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, job_name: str, operation_id: str, **kwargs: Any ) -> None: """Fetches the result of any operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param job_name: Job name whose operation result has to be fetched. + :param job_name: Job name whose operation result has to be fetched. Required. :type job_name: str :param operation_id: OperationID which represents the operation whose result has to be fetched. + Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, job_name=job_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -146,5 +142,4 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py index 1658073c9a2cb..1854a16e00dea 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py @@ -8,131 +8,127 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_export_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - **kwargs: Any + vault_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def export( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - filter: Optional[str] = None, - **kwargs: Any + self, vault_name: str, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> None: """Triggers export of jobs specified by filters and returns an OperationID to track. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_export_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.export.metadata['url'], + api_version=api_version, + template_url=self.export.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -142,5 +138,4 @@ def export( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - export.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore - + export.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py index 3b5c1fcc2399b..51c133b089466 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py @@ -6,124 +6,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_validate_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class OperationOperations(object): - """OperationOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class OperationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`operation` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def validate( self, vault_name: str, resource_group_name: str, - parameters: "_models.ValidateOperationRequest", + parameters: _models.ValidateOperationRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.ValidateOperationsResponse": + ) -> _models.ValidateOperationsResponse: """Validate operation for specified backed up item. This is a synchronous operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource validate operation request. + :param parameters: resource validate operation request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateOperationsResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ValidateOperationsResponse: + """Validate operation for specified backed up item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ValidateOperationsResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def validate( + self, + vault_name: str, + resource_group_name: str, + parameters: Union[_models.ValidateOperationRequest, IO], + **kwargs: Any + ) -> _models.ValidateOperationsResponse: + """Validate operation for specified backed up item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Is either a model type or a IO type. + Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateOperationsResponse, or the result of cls(response) + :return: ValidateOperationsResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateOperationsResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateOperationsResponse] - _json = self._serialize.body(parameters, 'ValidateOperationRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateOperationRequest") request = build_validate_request( vault_name=vault_name, @@ -132,28 +195,29 @@ def validate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate.metadata['url'], + content=_content, + template_url=self.validate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ValidateOperationsResponse', pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore - + validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py index 7472819c9f9ec..2df2f94d9fbaa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py @@ -7,111 +7,112 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - accept = "application/json" +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.RecoveryServices/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class Operations(object): - """Operations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ClientDiscoveryResponse"]: + def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingleApi"]: """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 + :return: An iterator like instance of either ClientDiscoveryValueForSingleApi or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryResponse] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryValueForSingleApi] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientDiscoveryResponse] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -125,10 +126,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,8 +137,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.RecoveryServices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.RecoveryServices/operations"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py index 9e00e98501c62..58cc05c9f8b53 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py @@ -6,218 +6,215 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_put_request_initial( +def build_put_request( vault_name: str, resource_group_name: str, - subscription_id: str, private_endpoint_connection_name: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request_initial( +def build_delete_request( vault_name: str, resource_group_name: str, - subscription_id: str, private_endpoint_connection_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class PrivateEndpointConnectionOperations(object): - """PrivateEndpointConnectionOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateEndpointConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`private_endpoint_connection` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - private_endpoint_connection_name: str, - **kwargs: Any - ) -> "_models.PrivateEndpointConnectionResource": + self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionResource: """Get Private Endpoint Connection. This call is made by Backup Admin. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnectionResource, or the result of cls(response) + :return: PrivateEndpointConnectionResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,53 +222,61 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _put_initial( self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnectionResource", + parameters: Union[_models.PrivateEndpointConnectionResource, IO], **kwargs: Any - ) -> "_models.PrivateEndpointConnectionResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'PrivateEndpointConnectionResource') - - request = build_put_request_initial( + ) -> _models.PrivateEndpointConnectionResource: + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnectionResource") + + request = build_put_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._put_initial.metadata['url'], + content=_content, + template_url=self._put_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -279,18 +284,98 @@ def _put_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @overload + def begin_put( + self, + vault_name: str, + resource_group_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnectionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Request body for operation. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnectionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_put( + self, + vault_name: str, + resource_group_name: str, + private_endpoint_connection_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: + """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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 PrivateEndpointConnectionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def begin_put( @@ -298,21 +383,24 @@ def begin_put( vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnectionResource", + parameters: Union[_models.PrivateEndpointConnectionResource, IO], **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnectionResource"]: + ) -> LROPoller[_models.PrivateEndpointConnectionResource]: """Approve or Reject Private Endpoint requests. This call is made by Backup Admin. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param parameters: Request body for operation. + :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -325,84 +413,84 @@ def begin_put( result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._put_initial( + raw_result = self._put_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('PrivateEndpointConnectionResource', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, private_endpoint_connection_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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -412,25 +500,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - private_endpoint_connection_name: str, - **kwargs: Any + def begin_delete( + self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: """Delete Private Endpoint requests. This call is made by Backup Admin. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_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. @@ -442,42 +525,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._delete_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py index 5d6d1c13fb5de..9b6166ff7823d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py @@ -8,83 +8,89 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_operation_status_request( vault_name: str, resource_group_name: str, - subscription_id: str, private_endpoint_connection_name: str, operation_id: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class PrivateEndpointOperations(object): - """PrivateEndpointOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PrivateEndpointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`private_endpoint` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_operation_status( @@ -94,51 +100,52 @@ def get_operation_status( private_endpoint_connection_name: str, operation_id: str, **kwargs: Any - ) -> "_models.OperationStatus": + ) -> _models.OperationStatus: """Gets the operation status for a private endpoint connection. Gets the operation status for a private endpoint connection. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. :type private_endpoint_connection_name: str - :param operation_id: Operation id. + :param operation_id: Operation id. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_operation_status_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_operation_status.metadata['url'], + template_url=self.get_operation_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -146,12 +153,11 @@ def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore - + get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py index 8167a821d5adc..f572cd284d476 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py @@ -7,150 +7,149 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectableContainersOperations(object): - """ProtectableContainersOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectableContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protectable_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.ProtectableContainerResourceList"]: + self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ProtectableContainerResource"]: """Lists the containers that can be registered to Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: + :param fabric_name: Required. :type fabric_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectableContainerResourceList or the result of + :return: An iterator like instance of either ProtectableContainerResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectableContainerResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableContainerResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -164,10 +163,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -177,8 +174,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py index a66d914b04746..5130a5b6a0cee 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py @@ -8,87 +8,91 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, operation_id: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectedItemOperationResultsOperations(object): - """ProtectedItemOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectedItemOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protected_item_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -100,56 +104,57 @@ def get( protected_item_name: str, operation_id: str, **kwargs: Any - ) -> Optional["_models.ProtectedItemResource"]: + ) -> Optional[_models.ProtectedItemResource]: """Fetches the result of any operation on the backup item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Backup item name whose details are to be fetched. + :param protected_item_name: Backup item name whose details are to be fetched. Required. :type protected_item_name: str :param operation_id: OperationID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemResource, or the result of cls(response) + :return: ProtectedItemResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectedItemResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -158,12 +163,11 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectedItemResource', pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py index 161185ad9bc96..4d7ba6c630fa2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py @@ -8,87 +8,91 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, operation_id: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectedItemOperationStatusesOperations(object): - """ProtectedItemOperationStatusesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectedItemOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protected_item_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -100,71 +104,72 @@ def get( protected_item_name: str, operation_id: str, **kwargs: Any - ) -> "_models.OperationStatus": + ) -> _models.OperationStatus: """Fetches the status of an operation such as triggering a backup, restore. The status can be in progress, completed or failed. You can refer to the OperationStatus enum for all the possible states of the operation. Some operations create jobs. This method returns the list of jobs associated with the operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Backup item name whose details are to be fetched. + :param protected_item_name: Backup item name whose details are to be fetched. Required. :type protected_item_name: str :param operation_id: OperationID represents the operation whose status needs to be fetched. + Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py index 3a4b2c3328751..5c1b414891e87 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py @@ -6,184 +6,178 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectedItemsOperations(object): - """ProtectedItemsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectedItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protected_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -195,72 +189,152 @@ def get( protected_item_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> "_models.ProtectedItemResource": + ) -> _models.ProtectedItemResource: """Provides the details of the backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item name whose details are to be fetched. + :param protected_item_name: Backed up item name whose details are to be fetched. Required. :type protected_item_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemResource, or the result of cls(response) + :return: ProtectedItemResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.get.metadata['url'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectedItemResource', pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + @overload + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: _models.ProtectedItemResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectedItemResource]: + """Enables backup of an item or to modifies the backup policy information of an already backed up + item. This is an + asynchronous operation. To know the status of the operation, call the GetItemOperationResult + API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Item name to be backed up. Required. + :type protected_item_name: str + :param parameters: resource backed up item. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectedItemResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectedItemResource]: + """Enables backup of an item or to modifies the backup policy information of an already backed up + item. This is an + asynchronous operation. To know the status of the operation, call the GetItemOperationResult + API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param container_name: Container name associated with the backup item. Required. + :type container_name: str + :param protected_item_name: Item name to be backed up. Required. + :type protected_item_name: str + :param parameters: resource backed up item. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectedItemResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_or_update( @@ -270,63 +344,76 @@ def create_or_update( fabric_name: str, container_name: str, protected_item_name: str, - parameters: "_models.ProtectedItemResource", + parameters: Union[_models.ProtectedItemResource, IO], **kwargs: Any - ) -> Optional["_models.ProtectedItemResource"]: + ) -> Optional[_models.ProtectedItemResource]: """Enables backup of an item or to modifies the backup policy information of an already backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param container_name: Container name associated with the backup item. + :param container_name: Container name associated with the backup item. Required. :type container_name: str - :param protected_item_name: Item name to be backed up. + :param protected_item_name: Item name to be backed up. Required. :type protected_item_name: str - :param parameters: resource backed up item. + :param parameters: resource backed up item. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectedItemResource, or the result of cls(response) + :return: ProtectedItemResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectedItemResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ProtectedItemResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectedItemResource") request = build_create_or_update_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -335,15 +422,14 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectedItemResource', pipeline_response) + deserialized = self._deserialize("ProtectedItemResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -359,49 +445,50 @@ def delete( # pylint: disable=inconsistent-return-statements know the status of the request, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item to be deleted. + :param protected_item_name: Backed up item to be deleted. Required. :type protected_item_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -411,5 +498,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py index 599246c4c17cc..4097393b471ae 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py @@ -8,85 +8,89 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, operation_id: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectionContainerOperationResultsOperations(object): - """ProtectionContainerOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectionContainerOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_container_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( @@ -97,54 +101,55 @@ def get( container_name: str, operation_id: str, **kwargs: Any - ) -> Optional["_models.ProtectionContainerResource"]: + ) -> Optional[_models.ProtectionContainerResource]: """Fetches the result of any operation on the container. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Container name whose information should be fetched. + :param container_name: Container name whose information should be fetched. Required. :type container_name: str :param operation_id: Operation ID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerResource, or the result of cls(response) + :return: ProtectionContainerResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -153,12 +158,11 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerResource', pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py index 2f114a77b1730..11071fe76701b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py @@ -8,136 +8,131 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - fabric_name: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, fabric_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectionContainerRefreshOperationResultsOperations(object): - """ProtectionContainerRefreshOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectionContainerRefreshOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_container_refresh_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - operation_id: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, operation_id: str, **kwargs: Any ) -> None: """Provides the result of the refresh operation triggered by the BeginRefresh operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str :param operation_id: Operation ID associated with the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -147,5 +142,4 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py index ce732c55ada22..a239c32f0a6bd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py @@ -6,327 +6,389 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_register_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_unregister_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_inquire_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_refresh_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectionContainersOperations(object): - """ProtectionContainersOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_containers` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - container_name: str, - **kwargs: Any - ) -> "_models.ProtectionContainerResource": + self, vault_name: str, resource_group_name: str, fabric_name: str, container_name: str, **kwargs: Any + ) -> _models.ProtectionContainerResource: """Gets details of the specific container registered to your Recovery Services Vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Name of the fabric where the container belongs. + :param fabric_name: Name of the fabric where the container belongs. Required. :type fabric_name: str - :param container_name: Name of the container whose details need to be fetched. + :param container_name: Name of the container whose details need to be fetched. Required. :type container_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerResource, or the result of cls(response) + :return: ProtectionContainerResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionContainerResource', pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + @overload + def register( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + parameters: _models.ProtectionContainerResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionContainerResource]: + """Registers the container with Recovery Services vault. + This is an asynchronous operation. To track the operation status, use location header to call + get latest status of + the operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container to be registered. Required. + :type container_name: str + :param parameters: Request body for operation. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionContainerResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or + None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def register( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionContainerResource]: + """Registers the container with Recovery Services vault. + This is an asynchronous operation. To track the operation status, use location header to call + get latest status of + the operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container to be registered. Required. + :type container_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionContainerResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or + None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def register( @@ -335,62 +397,74 @@ def register( resource_group_name: str, fabric_name: str, container_name: str, - parameters: "_models.ProtectionContainerResource", + parameters: Union[_models.ProtectionContainerResource, IO], **kwargs: Any - ) -> Optional["_models.ProtectionContainerResource"]: + ) -> Optional[_models.ProtectionContainerResource]: """Registers the container with Recovery Services vault. This is an asynchronous operation. To track the operation status, use location header to call get latest status of the operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container to be registered. + :param container_name: Name of the container to be registered. Required. :type container_name: str - :param parameters: Request body for operation. + :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionContainerResource, or the result of cls(response) + :return: ProtectionContainerResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionContainerResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ProtectionContainerResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectionContainerResource") request = build_register_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.register.metadata['url'], + content=_content, + template_url=self.register.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -399,71 +473,66 @@ def register( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionContainerResource', pipeline_response) + deserialized = self._deserialize("ProtectionContainerResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - register.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore - + register.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace def unregister( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - container_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, container_name: str, **kwargs: Any ) -> None: """Unregisters the given container from your Recovery Services Vault. This is an asynchronous operation. To determine whether the backend service has finished processing the request, call Get Container Operation Result API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Name of the fabric where the container belongs. + :param fabric_name: Name of the fabric where the container belongs. Required. :type fabric_name: str :param container_name: Name of the container which needs to be unregistered from the Recovery - Services Vault. + Services Vault. Required. :type container_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_unregister_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.unregister.metadata['url'], + template_url=self.unregister.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -473,8 +542,7 @@ def unregister( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - unregister.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore - + unregister.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace def inquire( # pylint: disable=inconsistent-return-statements @@ -491,49 +559,50 @@ def inquire( # pylint: disable=inconsistent-return-statements This is an async operation and the results should be tracked using location header or Azure-async-url. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric Name associated with the container. + :param fabric_name: Fabric Name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container in which inquiry needs to be triggered. + :param container_name: Name of the container in which inquiry needs to be triggered. Required. :type container_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_inquire_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.inquire.metadata['url'], + api_version=api_version, + template_url=self.inquire.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -543,63 +612,58 @@ def inquire( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - inquire.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore - + inquire.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore @distributed_trace def refresh( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - filter: Optional[str] = None, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, filter: Optional[str] = None, **kwargs: Any ) -> None: """Discovers all the containers in the subscription that can be backed up to Recovery Services Vault. This is an asynchronous operation. To know the status of the operation, call GetRefreshOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated the container. + :param fabric_name: Fabric name associated the container. Required. :type fabric_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_refresh_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.refresh.metadata['url'], + api_version=api_version, + template_url=self.refresh.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -609,5 +673,4 @@ def refresh( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - refresh.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore - + refresh.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py index ba7c088db5e82..8a742d18199fa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py @@ -6,218 +6,203 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_validate_request( - azure_region: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - accept = "application/json" +def build_validate_request(azure_region: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, intent_object_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, intent_object_name: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, intent_object_name: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str # Construct URL - _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - **kwargs - ) - -class ProtectionIntentOperations(object): - """ProtectionIntentOperations 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.recoveryservicesbackup.activestamp.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. + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class ProtectionIntentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_intent` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def validate( self, azure_region: str, - parameters: "_models.PreValidateEnableBackupRequest", + parameters: _models.PreValidateEnableBackupRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.PreValidateEnableBackupResponse": + ) -> _models.PreValidateEnableBackupResponse: """It will validate followings @@ -232,26 +217,100 @@ def validate( #. VM is already protected #. Any VM related configuration passed in properties. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Enable backup validation request on Virtual Machine. + :param parameters: Enable backup validation request on Virtual Machine. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreValidateEnableBackupResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def validate( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.PreValidateEnableBackupResponse: + """It will validate followings + + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + It will validate followings + + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Enable backup validation request on Virtual Machine. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PreValidateEnableBackupResponse, or the result of cls(response) + :return: PreValidateEnableBackupResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PreValidateEnableBackupResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @distributed_trace + def validate( + self, azure_region: str, parameters: Union[_models.PreValidateEnableBackupRequest, IO], **kwargs: Any + ) -> _models.PreValidateEnableBackupResponse: + """It will validate followings + - _json = self._serialize.body(parameters, 'PreValidateEnableBackupRequest') + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + It will validate followings + + + #. Vault capacity + #. VM is already protected + #. Any VM related configuration passed in properties. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: Enable backup validation request on Virtual Machine. Is either a model type + or a IO type. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PreValidateEnableBackupResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.PreValidateEnableBackupResponse] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PreValidateEnableBackupRequest") request = build_validate_request( azure_region=azure_region, @@ -259,100 +318,165 @@ def validate( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validate.metadata['url'], + content=_content, + template_url=self.validate.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PreValidateEnableBackupResponse', pipeline_response) + deserialized = self._deserialize("PreValidateEnableBackupResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore - + validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - intent_object_name: str, - **kwargs: Any - ) -> "_models.ProtectionIntentResource": + self, vault_name: str, resource_group_name: str, fabric_name: str, intent_object_name: str, **kwargs: Any + ) -> _models.ProtectionIntentResource: """Provides the details of the protection intent up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param intent_object_name: Backed up item name whose details are to be fetched. + :param intent_object_name: Backed up item name whose details are to be fetched. Required. :type intent_object_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionIntentResource, or the result of cls(response) + :return: ProtectionIntentResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionIntentResource', pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + @overload + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + intent_object_name: str, + parameters: _models.ProtectionIntentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProtectionIntentResource: + """Create Intent for Enabling backup of an item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param intent_object_name: Intent object name. Required. + :type intent_object_name: str + :param parameters: resource backed up item. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionIntentResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + intent_object_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProtectionIntentResource: + """Create Intent for Enabling backup of an item. This is a synchronous operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backup item. Required. + :type fabric_name: str + :param intent_object_name: Intent object name. Required. + :type intent_object_name: str + :param parameters: resource backed up item. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionIntentResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_or_update( @@ -361,125 +485,132 @@ def create_or_update( resource_group_name: str, fabric_name: str, intent_object_name: str, - parameters: "_models.ProtectionIntentResource", + parameters: Union[_models.ProtectionIntentResource, IO], **kwargs: Any - ) -> "_models.ProtectionIntentResource": + ) -> _models.ProtectionIntentResource: """Create Intent for Enabling backup of an item. This is a synchronous operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backup item. + :param fabric_name: Fabric name associated with the backup item. Required. :type fabric_name: str - :param intent_object_name: Intent object name. + :param intent_object_name: Intent object name. Required. :type intent_object_name: str - :param parameters: resource backed up item. + :param parameters: resource backed up item. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionIntentResource, or the result of cls(response) + :return: ProtectionIntentResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'ProtectionIntentResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectionIntentResource") request = build_create_or_update_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionIntentResource', pipeline_response) + deserialized = self._deserialize("ProtectionIntentResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore - + create_or_update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - fabric_name: str, - intent_object_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, fabric_name: str, intent_object_name: str, **kwargs: Any ) -> None: """Used to remove intent from an item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the intent. + :param fabric_name: Fabric name associated with the intent. Required. :type fabric_name: str - :param intent_object_name: Intent to be deleted. + :param intent_object_name: Intent to be deleted. Required. :type intent_object_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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -489,5 +620,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore - + delete.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py index db502870ceadf..e787c13107b0f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py @@ -6,235 +6,280 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - policy_name: str, - **kwargs: Any + vault_name: str, resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_create_or_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - policy_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - vault_name: str, - resource_group_name: str, - subscription_id: str, - policy_name: str, - **kwargs: Any + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + vault_name: str, resource_group_name: str, policy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectionPoliciesOperations(object): - """ProtectionPoliciesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectionPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_policies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - **kwargs: Any - ) -> "_models.ProtectionPolicyResource": + self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any + ) -> _models.ProtectionPolicyResource: """Provides the details of the backup policies associated to Recovery Services Vault. This is an asynchronous operation. Status of the operation can be fetched using GetPolicyOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy information to be fetched. + :param policy_name: Backup policy information to be fetched. Required. :type policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionPolicyResource, or the result of cls(response) + :return: ProtectionPolicyResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionPolicyResource', pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + + @overload + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + policy_name: str, + parameters: _models.ProtectionPolicyResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionPolicyResource]: + """Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation + can be fetched + using GetPolicyOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param policy_name: Backup policy to be created. Required. + :type policy_name: str + :param parameters: resource backup policy. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionPolicyResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + policy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[_models.ProtectionPolicyResource]: + """Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation + can be fetched + using GetPolicyOperationResult API. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param policy_name: Backup policy to be created. Required. + :type policy_name: str + :param parameters: resource backup policy. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProtectionPolicyResource or None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def create_or_update( @@ -242,57 +287,69 @@ def create_or_update( vault_name: str, resource_group_name: str, policy_name: str, - parameters: "_models.ProtectionPolicyResource", + parameters: Union[_models.ProtectionPolicyResource, IO], **kwargs: Any - ) -> Optional["_models.ProtectionPolicyResource"]: + ) -> Optional[_models.ProtectionPolicyResource]: """Creates or modifies a backup policy. This is an asynchronous operation. Status of the operation can be fetched using GetPolicyOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy to be created. + :param policy_name: Backup policy to be created. Required. :type policy_name: str - :param parameters: resource backup policy. + :param parameters: resource backup policy. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionPolicyResource, or the result of cls(response) + :return: ProtectionPolicyResource or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ProtectionPolicyResource"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionPolicyResource]] - _json = self._serialize.body(parameters, 'ProtectionPolicyResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ProtectionPolicyResource") request = build_create_or_update_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.create_or_update.metadata['url'], + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -301,48 +358,44 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ProtectionPolicyResource', pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, policy_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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - request = build_delete_request_initial( + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -352,27 +405,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - **kwargs: Any + def begin_delete( + self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any ) -> LROPoller[None]: """Deletes specified backup policy from your Recovery Services Vault. This is an asynchronous operation. Status of the operation can be fetched using GetProtectionPolicyOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy to be deleted. + :param policy_name: Backup policy to be deleted. Required. :type policy_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. @@ -384,42 +432,46 @@ def begin_delete( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._delete_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, policy_name=policy_name, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py index 8d03449f47748..b006b29f6fcb1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py @@ -8,148 +8,142 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - policy_name: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, policy_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectionPolicyOperationResultsOperations(object): - """ProtectionPolicyOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectionPolicyOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_policy_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.ProtectionPolicyResource": + self, vault_name: str, resource_group_name: str, policy_name: str, operation_id: str, **kwargs: Any + ) -> _models.ProtectionPolicyResource: """Provides the result of an operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy name whose operation's result needs to be fetched. + :param policy_name: Backup policy name whose operation's result needs to be fetched. Required. :type policy_name: str :param operation_id: Operation ID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProtectionPolicyResource, or the result of cls(response) + :return: ProtectionPolicyResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ProtectionPolicyResource', pipeline_response) + deserialized = self._deserialize("ProtectionPolicyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py index b2b00597fef65..296580a0b71da 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py @@ -8,152 +8,146 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - policy_name: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, policy_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ProtectionPolicyOperationStatusesOperations(object): - """ProtectionPolicyOperationStatusesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProtectionPolicyOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`protection_policy_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - policy_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, policy_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Provides the status of the asynchronous operations like backup, restore. The status can be in progress, completed or failed. You can refer to the Operation Status enum for all the possible states of an operation. Some operations create jobs. This method returns the list of jobs associated with operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param policy_name: Backup policy name whose operation's status needs to be fetched. + :param policy_name: Backup policy name whose operation's status needs to be fetched. Required. :type policy_name: str :param operation_id: Operation ID which represents an operation whose status needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py index a6e6f293bd23a..2fb4350a03136 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py @@ -7,135 +7,138 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, recovery_point_id: str, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RecoveryPointsOperations(object): - """RecoveryPointsOperations operations. - - 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -147,68 +150,65 @@ def list( protected_item_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RecoveryPointResourceList"]: + ) -> Iterable["_models.RecoveryPointResource"]: """Lists the backup copies for the backed up item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item whose backup copies are to be fetched. + :param protected_item_name: Backed up item whose backup copies are to be fetched. Required. :type protected_item_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointResourceList or the result of + :return: An iterator like instance of either RecoveryPointResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - protected_item_name=protected_item_name, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -222,10 +222,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -235,11 +233,9 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore @distributed_trace def get( @@ -251,69 +247,71 @@ def get( protected_item_name: str, recovery_point_id: str, **kwargs: Any - ) -> "_models.RecoveryPointResource": + ) -> _models.RecoveryPointResource: """Provides the information of the backed up data identified using RecoveryPointID. This is an asynchronous operation. To know the status of the operation, call the GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with backed up item. + :param fabric_name: Fabric name associated with backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with backed up item. + :param container_name: Container name associated with backed up item. Required. :type container_name: str :param protected_item_name: Backed up item name whose backup data needs to be fetched. + Required. :type protected_item_name: str :param recovery_point_id: RecoveryPointID represents the backed up data to be fetched. + Required. :type recovery_point_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoveryPointResource, or the result of cls(response) + :return: RecoveryPointResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('RecoveryPointResource', pipeline_response) + deserialized = self._deserialize("RecoveryPointResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py index 3a9e4b29bca39..7f86194ad17b3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py @@ -6,97 +6,96 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class RecoveryPointsRecommendedForMoveOperations(object): - """RecoveryPointsRecommendedForMoveOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class RecoveryPointsRecommendedForMoveOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`recovery_points_recommended_for_move` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -106,76 +105,83 @@ def list( fabric_name: str, container_name: str, protected_item_name: str, - parameters: "_models.ListRecoveryPointsRecommendedForMoveRequest", + parameters: Union[_models.ListRecoveryPointsRecommendedForMoveRequest, IO], **kwargs: Any - ) -> Iterable["_models.RecoveryPointResourceList"]: + ) -> Iterable["_models.RecoveryPointResource"]: """Lists the recovery points recommended for move to another tier. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: + :param fabric_name: Required. :type fabric_name: str - :param container_name: + :param container_name: Required. :type container_name: str - :param protected_item_name: + :param protected_item_name: Required. :type protected_item_name: str - :param parameters: List Recovery points Recommended for Move Request. + :param parameters: List Recovery points Recommended for Move Request. Is either a model type or + a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ListRecoveryPointsRecommendedForMoveRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointResourceList or the result of + :return: An iterator like instance of either RecoveryPointResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - _json = self._serialize.body(parameters, 'ListRecoveryPointsRecommendedForMoveRequest') - + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ListRecoveryPointsRecommendedForMoveRequest") + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.list.metadata['url'], + content=_content, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - _json = self._serialize.body(parameters, 'ListRecoveryPointsRecommendedForMoveRequest') - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - protected_item_name=protected_item_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -189,10 +195,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -202,8 +206,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py index 8a62e097932b4..04ac3bcdf3bee 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py @@ -6,254 +6,225 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_operation_status_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_bms_prepare_data_move_request_initial( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any +def build_bms_prepare_data_move_request( + vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_bms_trigger_data_move_request_initial( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any +def build_bms_trigger_data_move_request( + vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_move_recovery_point_request_initial( +def build_move_recovery_point_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, recovery_point_id: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class RecoveryServicesBackupClientOperationsMixin(object): +class RecoveryServicesBackupClientOperationsMixin(MixinABC): @distributed_trace def get_operation_status( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Fetches operation status for data move operation on vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_operation_status_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_operation_status.metadata['url'], + template_url=self.get_operation_status.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -261,80 +232,162 @@ def get_operation_status( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore - + get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.PrepareDataMoveRequest", + parameters: Union[_models.PrepareDataMoveRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'PrepareDataMoveRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrepareDataMoveRequest") - request = build_bms_prepare_data_move_request_initial( + request = build_bms_prepare_data_move_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._bms_prepare_data_move_initial.metadata['url'], + content=_content, + template_url=self._bms_prepare_data_move_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _bms_prepare_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + _bms_prepare_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + @overload + def begin_bms_prepare_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.PrepareDataMoveRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Prepares source vault for Data Move operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Prepare data move request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_bms_prepare_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Prepares source vault for Data Move operation. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Prepare data move request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statements + def begin_bms_prepare_data_move( self, vault_name: str, resource_group_name: str, - parameters: "_models.PrepareDataMoveRequest", + parameters: Union[_models.PrepareDataMoveRequest, IO], **kwargs: Any ) -> LROPoller[None]: """Prepares source vault for Data Move operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Prepare data move request. + :param parameters: Prepare data move request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -345,112 +398,199 @@ def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statemen Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._bms_prepare_data_move_initial( + raw_result = self._bms_prepare_data_move_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_prepare_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + begin_bms_prepare_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.TriggerDataMoveRequest", + parameters: Union[_models.TriggerDataMoveRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'TriggerDataMoveRequest') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_bms_trigger_data_move_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TriggerDataMoveRequest") + + request = build_bms_trigger_data_move_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._bms_trigger_data_move_initial.metadata['url'], + content=_content, + template_url=self._bms_trigger_data_move_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _bms_trigger_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + _bms_trigger_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + @overload + def begin_bms_trigger_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.TriggerDataMoveRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Triggers Data Move Operation on target vault. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Trigger data move request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_bms_trigger_data_move( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Triggers Data Move Operation on target vault. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Trigger data move request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statements + def begin_bms_trigger_data_move( self, vault_name: str, resource_group_name: str, - parameters: "_models.TriggerDataMoveRequest", + parameters: Union[_models.TriggerDataMoveRequest, IO], **kwargs: Any ) -> LROPoller[None]: """Triggers Data Move Operation on target vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Trigger data move request. + :param parameters: Trigger data move request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -461,47 +601,51 @@ def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statemen Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._bms_trigger_data_move_initial( + raw_result = self._bms_trigger_data_move_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_trigger_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + begin_bms_trigger_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements self, @@ -511,41 +655,50 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.MoveRPAcrossTiersRequest", + parameters: Union[_models.MoveRPAcrossTiersRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'MoveRPAcrossTiersRequest') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_move_recovery_point_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MoveRPAcrossTiersRequest") + + request = build_move_recovery_point_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._move_recovery_point_initial.metadata['url'], + content=_content, + template_url=self._move_recovery_point_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -555,11 +708,109 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - _move_recovery_point_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + _move_recovery_point_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + + @overload + def begin_move_recovery_point( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: _models.MoveRPAcrossTiersRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Move recovery point from one datastore to another store. + + Move recovery point from one datastore to another store. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Required. + :type fabric_name: str + :param container_name: Required. + :type container_name: str + :param protected_item_name: Required. + :type protected_item_name: str + :param recovery_point_id: Required. + :type recovery_point_id: str + :param parameters: Move Resource Across Tiers Request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_move_recovery_point( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Move recovery point from one datastore to another store. + Move recovery point from one datastore to another store. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Required. + :type fabric_name: str + :param container_name: Required. + :type container_name: str + :param protected_item_name: Required. + :type protected_item_name: str + :param recovery_point_id: Required. + :type recovery_point_id: str + :param parameters: Move Resource Across Tiers Request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements + def begin_move_recovery_point( self, vault_name: str, resource_group_name: str, @@ -567,29 +818,33 @@ def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.MoveRPAcrossTiersRequest", + parameters: Union[_models.MoveRPAcrossTiersRequest, IO], **kwargs: Any ) -> LROPoller[None]: """Move recovery point from one datastore to another store. Move recovery point from one datastore to another store. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: + :param fabric_name: Required. :type fabric_name: str - :param container_name: + :param container_name: Required. :type container_name: str - :param protected_item_name: + :param protected_item_name: Required. :type protected_item_name: str - :param recovery_point_id: + :param recovery_point_id: Required. :type recovery_point_id: str - :param parameters: Move Resource Across Tiers Request. + :param parameters: Move Resource Across Tiers Request. Is either a model type or a IO type. + Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest + ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -600,19 +855,19 @@ def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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._move_recovery_point_initial( + raw_result = self._move_recovery_point_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -622,26 +877,30 @@ def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_move_recovery_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + begin_move_recovery_point.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py index 5d077b210e364..c8f2c1d7eaa85 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py @@ -7,134 +7,132 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - accept = "application/json" +def build_get_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ResourceGuardProxiesOperations(object): - """ResourceGuardProxiesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ResourceGuardProxiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`resource_guard_proxies` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ResourceGuardProxyBaseResourceList"]: + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ResourceGuardProxyBaseResource"]: """List the ResourceGuardProxies under vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :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 ResourceGuardProxyBaseResourceList or the result - of cls(response) + :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of + cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_get_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -148,10 +146,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,8 +157,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py index c5e5e62783772..5b957f45ef965 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py @@ -6,277 +6,309 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - resource_guard_proxy_name: str, - **kwargs: Any + vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_put_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - resource_guard_proxy_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - resource_guard_proxy_name: str, - **kwargs: Any + vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_unlock_delete_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - resource_guard_proxy_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ResourceGuardProxyOperations(object): - """ResourceGuardProxyOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`resource_guard_proxy` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - resource_guard_proxy_name: str, - **kwargs: Any - ) -> "_models.ResourceGuardProxyBaseResource": + self, vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: """Returns ResourceGuardProxy under vault and with the name referenced in request. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource, or the result of cls(response) + :return: ResourceGuardProxyBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceGuardProxyBaseResource', pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + @overload + def put( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Add or Update ResourceGuardProxy under vault + Secures vault critical operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Add or Update ResourceGuardProxy under vault + Secures vault critical operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceGuardProxyBaseResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def put( @@ -284,119 +316,127 @@ def put( vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, - parameters: "_models.ResourceGuardProxyBaseResource", + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], **kwargs: Any - ) -> "_models.ResourceGuardProxyBaseResource": + ) -> _models.ResourceGuardProxyBaseResource: """Add or Update ResourceGuardProxy under vault Secures vault critical operations. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str - :param parameters: Request body for operation. + :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource, or the result of cls(response) + :return: ResourceGuardProxyBaseResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] - _json = self._serialize.body(parameters, 'ResourceGuardProxyBaseResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") request = build_put_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.put.metadata['url'], + content=_content, + template_url=self.put.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ResourceGuardProxyBaseResource', pipeline_response) + deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - + put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, - vault_name: str, - resource_group_name: str, - resource_guard_proxy_name: str, - **kwargs: Any + self, vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, **kwargs: Any ) -> None: """Delete ResourceGuardProxy under vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -406,8 +446,69 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + @overload + def unlock_delete( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """Secures delete ResourceGuardProxy operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unlock_delete( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """Secures delete ResourceGuardProxy operations. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param resource_guard_proxy_name: Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UnlockDeleteResponse or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def unlock_delete( @@ -415,66 +516,78 @@ def unlock_delete( vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, - parameters: "_models.UnlockDeleteRequest", + parameters: Union[_models.UnlockDeleteRequest, IO], **kwargs: Any - ) -> "_models.UnlockDeleteResponse": + ) -> _models.UnlockDeleteResponse: """Secures delete ResourceGuardProxy operations. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param resource_guard_proxy_name: + :param resource_guard_proxy_name: Required. :type resource_guard_proxy_name: str - :param parameters: Request body for operation. - :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteRequest + :param parameters: Request body for operation. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteRequest or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse, or the result of cls(response) + :return: UnlockDeleteResponse or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UnlockDeleteResponse"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.UnlockDeleteResponse] - _json = self._serialize.body(parameters, 'UnlockDeleteRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "UnlockDeleteRequest") request = build_unlock_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.unlock_delete.metadata['url'], + content=_content, + template_url=self.unlock_delete.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('UnlockDeleteResponse', pipeline_response) + deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - unlock_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore - + unlock_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py index ea2d053ccb8ce..70ce602f75d67 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py @@ -6,100 +6,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_trigger_request_initial( + +def build_trigger_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, recovery_point_id: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class RestoresOperations(object): - """RestoresOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class RestoresOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`restores` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _trigger_initial( # pylint: disable=inconsistent-return-statements self, @@ -109,41 +107,50 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.RestoreRequestResource", + parameters: Union[_models.RestoreRequestResource, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'RestoreRequestResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_trigger_request_initial( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "RestoreRequestResource") + + request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._trigger_initial.metadata['url'], + content=_content, + template_url=self._trigger_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -153,11 +160,110 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + + @overload + def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: _models.RestoreRequestResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restores the specified backed up data. This is an asynchronous operation. To know the status of + this API call, use + GetProtectedItemOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item to be restored. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents the backed up data to be restored. + Required. + :type recovery_point_id: str + :param parameters: resource restore request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequestResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restores the specified backed up data. This is an asynchronous operation. To know the status of + this API call, use + GetProtectedItemOperationResult API. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the backed up items. Required. + :type fabric_name: str + :param container_name: Container name associated with the backed up items. Required. + :type container_name: str + :param protected_item_name: Backed up item to be restored. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery point ID which represents the backed up data to be restored. + Required. + :type recovery_point_id: str + :param parameters: resource restore request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_trigger( # pylint: disable=inconsistent-return-statements + def begin_trigger( self, vault_name: str, resource_group_name: str, @@ -165,28 +271,33 @@ def begin_trigger( # pylint: disable=inconsistent-return-statements container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.RestoreRequestResource", + parameters: Union[_models.RestoreRequestResource, IO], **kwargs: Any ) -> LROPoller[None]: """Restores the specified backed up data. This is an asynchronous operation. To know the status of this API call, use GetProtectedItemOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up items. + :param fabric_name: Fabric name associated with the backed up items. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up items. + :param container_name: Container name associated with the backed up items. Required. :type container_name: str - :param protected_item_name: Backed up item to be restored. + :param protected_item_name: Backed up item to be restored. Required. :type protected_item_name: str :param recovery_point_id: Recovery point ID which represents the backed up data to be restored. + Required. :type recovery_point_id: str - :param parameters: resource restore request. + :param parameters: resource restore request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequestResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -197,19 +308,19 @@ def begin_trigger( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._trigger_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, fabric_name=fabric_name, @@ -219,26 +330,30 @@ def begin_trigger( # pylint: disable=inconsistent-return-statements parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py index 97ebc08c3be9d..3188d8aa5690e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py @@ -6,126 +6,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + +def build_get_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class SecurityPINsOperations(object): - """SecurityPINsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SecurityPINsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`security_pins` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def get( self, vault_name: str, resource_group_name: str, - parameters: Optional["_models.SecurityPinBase"] = None, + parameters: Optional[_models.SecurityPinBase] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.TokenInformation": + ) -> _models.TokenInformation: """Get the security PIN. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param parameters: security pin request. Default value is None. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SecurityPinBase + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: TokenInformation, or the result of cls(response) + :return: TokenInformation or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TokenInformation"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @overload + def get( + self, + vault_name: str, + resource_group_name: str, + parameters: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.TokenInformation: + """Get the security PIN. - if parameters is not None: - _json = self._serialize.body(parameters, 'SecurityPinBase') + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: security pin request. Default value is None. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TokenInformation or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get( + self, + vault_name: str, + resource_group_name: str, + parameters: Optional[Union[_models.SecurityPinBase, IO]] = None, + **kwargs: Any + ) -> _models.TokenInformation: + """Get the security PIN. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: security pin request. Is either a model type or a IO type. Default value is + None. + :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SecurityPinBase or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TokenInformation or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TokenInformation] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - _json = None + if parameters is not None: + _json = self._serialize.body(parameters, "SecurityPinBase") + else: + _json = None request = build_get_request( vault_name=vault_name, @@ -134,28 +194,29 @@ def get( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get.metadata['url'], + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TokenInformation', pipeline_response) + deserialized = self._deserialize("TokenInformation", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py index 2bd97b7a3be7e..4b92adb78f528 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py @@ -6,128 +6,132 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_trigger_request_initial( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any + +def build_trigger_request( + vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ValidateOperationOperations(object): - """ValidateOperationOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ValidateOperationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`validate_operation` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _trigger_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.ValidateOperationRequest", + parameters: Union[_models.ValidateOperationRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'ValidateOperationRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ValidateOperationRequest") - request = build_trigger_request_initial( + request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._trigger_initial.metadata['url'], + content=_content, + template_url=self._trigger_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -137,28 +141,104 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + + @overload + def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.ValidateOperationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate operation for specified backed up item in the form of an asynchronous operation. + Returns tracking headers which can be tracked using GetValidateOperationResult API. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate operation for specified backed up item in the form of an asynchronous operation. + Returns tracking headers which can be tracked using GetValidateOperationResult API. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: resource validate operation request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_trigger( # pylint: disable=inconsistent-return-statements + def begin_trigger( self, vault_name: str, resource_group_name: str, - parameters: "_models.ValidateOperationRequest", + parameters: Union[_models.ValidateOperationRequest, IO], **kwargs: Any ) -> LROPoller[None]: """Validate operation for specified backed up item in the form of an asynchronous operation. Returns tracking headers which can be tracked using GetValidateOperationResult API. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: resource validate operation request. + :param parameters: resource validate operation request. Is either a model type or a IO type. + Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -169,44 +249,48 @@ def begin_trigger( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._trigger_initial( # type: ignore vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py index 892b87a47621a..4cb202d41968c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py @@ -8,131 +8,128 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ValidateOperationResultsOperations(object): - """ValidateOperationResultsOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ValidateOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`validate_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> Optional["_models.ValidateOperationsResponse"]: + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.ValidateOperationsResponse]: """Fetches the result of a triggered validate operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param operation_id: OperationID which represents the operation whose result needs to be - fetched. + fetched. Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: ValidateOperationsResponse, or the result of cls(response) + :return: ValidateOperationsResponse or None or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse or None - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ValidateOperationsResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ValidateOperationsResponse]] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -141,12 +138,11 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ValidateOperationsResponse', pipeline_response) + deserialized = self._deserialize("ValidateOperationsResponse", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py index ab125a1522c6d..fb3f55c1d9a59 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py @@ -8,145 +8,142 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') +from .._serialization import Serializer +from .._vendor import MixinABC, _convert_request, _format_url_section + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - operation_id: str, - **kwargs: Any + vault_name: str, resource_group_name: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ValidateOperationStatusesOperations(object): - """ValidateOperationStatusesOperations 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.recoveryservicesbackup.activestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ValidateOperationStatusesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`validate_operation_statuses` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( - self, - vault_name: str, - resource_group_name: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationStatus: """Fetches the status of a triggered validate operation. The status can be in progress, completed or failed. You can refer to the OperationStatus enum for all the possible states of the operation. If operation has completed, this method returns the list of errors obtained while validating the operation. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param operation_id: OperationID represents the operation whose status needs to be fetched. + Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py index 9121c742cc5c1..448b2d35b56a3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py @@ -10,9 +10,15 @@ from ._version import VERSION __version__ = VERSION -__all__ = ['RecoveryServicesBackupPassiveClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["RecoveryServicesBackupPassiveClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py index e00c358e98dc2..c82a5eaf3b4e1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py @@ -25,23 +25,18 @@ class RecoveryServicesBackupPassiveClientConfiguration(Configuration): # pylint 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. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-11-15". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupPassiveClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + api_version = kwargs.pop("api_version", "2021-11-15") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,23 +46,24 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicesbackup/{}".format(VERSION)) self._configure(**kwargs) def _configure( - self, - **kwargs # type: Any + 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') + 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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_patch.py index 026ba53859a17..a3a246e1b1d1e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_patch.py @@ -27,12 +27,15 @@ from typing import TYPE_CHECKING, Any, List, TYPE_CHECKING import importlib import urllib.parse -from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient as RecoveryServicesBackupPassiveClientGenerated +from ._recovery_services_backup_passive_client import ( + RecoveryServicesBackupPassiveClient as RecoveryServicesBackupPassiveClientGenerated, +) from azure.core.pipeline.policies import SansIOHTTPPolicy if TYPE_CHECKING: from azure.core.credentials import TokenCredential + class RemoveDuplicateParamsPolicy(SansIOHTTPPolicy): def __init__(self, duplicate_param_names): # type: (List[str]) -> None @@ -41,17 +44,19 @@ def __init__(self, duplicate_param_names): def on_request(self, request): parsed_url = urllib.parse.urlparse(request.http_request.url) query_params = urllib.parse.parse_qs(parsed_url.query) - filtered_query_params = { - k: v[-1:] if k in self.duplicate_param_names else v - for k, v in query_params.items() - } - request.http_request.url = request.http_request.url.replace(parsed_url.query, "") + urllib.parse.urlencode(filtered_query_params, doseq=True) + filtered_query_params = {k: v[-1:] if k in self.duplicate_param_names else v for k, v in query_params.items()} + request.http_request.url = request.http_request.url.replace(parsed_url.query, "") + urllib.parse.urlencode( + filtered_query_params, doseq=True + ) return super().on_request(request) + DUPLICATE_PARAMS_POLICY = RemoveDuplicateParamsPolicy(duplicate_param_names=["$filter", "$skiptoken", "api-version"]) + class RecoveryServicesBackupPassiveClient(RecoveryServicesBackupPassiveClientGenerated): __doc__ = RecoveryServicesBackupPassiveClientGenerated.__doc__ + def __init__( self, credential: "TokenCredential", @@ -72,6 +77,7 @@ def __init__( **kwargs ) + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py index 5e2ceb7590e3b..3582f46e5533e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models from ._configuration import RecoveryServicesBackupPassiveClientConfiguration -from .operations import AadPropertiesOperations, BackupCrrJobDetailsOperations, BackupCrrJobsOperations, BackupProtectedItemsCrrOperations, BackupResourceStorageConfigsOperations, BackupUsageSummariesCRROperations, CrossRegionRestoreOperations, CrrOperationResultsOperations, CrrOperationStatusOperations, RecoveryPointsCrrOperations, RecoveryPointsOperations +from ._serialization import Deserializer, Serializer +from .operations import ( + AadPropertiesOperations, + BackupCrrJobDetailsOperations, + BackupCrrJobsOperations, + BackupProtectedItemsCrrOperations, + BackupResourceStorageConfigsOperations, + BackupUsageSummariesCRROperations, + CrossRegionRestoreOperations, + CrrOperationResultsOperations, + CrrOperationStatusOperations, + RecoveryPointsCrrOperations, + RecoveryPointsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instance-attributes + +class RecoveryServicesBackupPassiveClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_usage_summaries_crr: BackupUsageSummariesCRROperations operations @@ -58,9 +70,9 @@ class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instanc :ivar backup_protected_items_crr: BackupProtectedItemsCrrOperations operations :vartype backup_protected_items_crr: azure.mgmt.recoveryservicesbackup.passivestamp.operations.BackupProtectedItemsCrrOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -78,31 +90,44 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = RecoveryServicesBackupPassiveClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = RecoveryServicesBackupPassiveClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.backup_usage_summaries_crr = BackupUsageSummariesCRROperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_usage_summaries_crr = BackupUsageSummariesCRROperations( + self._client, self._config, self._serialize, self._deserialize + ) self.aad_properties = AadPropertiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.cross_region_restore = CrossRegionRestoreOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_crr_job_details = BackupCrrJobDetailsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cross_region_restore = CrossRegionRestoreOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_crr_job_details = BackupCrrJobDetailsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_crr_jobs = BackupCrrJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.crr_operation_results = CrrOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.crr_operation_status = CrrOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.crr_operation_results = CrrOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.crr_operation_status = CrrOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_resource_storage_configs = BackupResourceStorageConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.recovery_points_crr = RecoveryPointsCrrOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protected_items_crr = BackupProtectedItemsCrrOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: + self.backup_resource_storage_configs = BackupResourceStorageConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.recovery_points_crr = RecoveryPointsCrrOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_protected_items_crr = BackupProtectedItemsCrrOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -111,7 +136,7 @@ def _send_request( >>> response = client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py new file mode 100644 index 0000000000000..648f84cc4e653 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py @@ -0,0 +1,1970 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# pylint: skip-file + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote # type: ignore +import xml.etree.ElementTree as ET + +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING + +from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +try: + basestring # type: ignore + unicode_str = unicode # type: ignore +except NameError: + basestring = str # type: ignore + unicode_str = str # type: ignore + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone as _FixedOffset +except ImportError: # Python 2.7 + + class _FixedOffset(datetime.tzinfo): # type: ignore + """Fixed offset in minutes east from UTC. + Copy/pasted from Python doc + :param datetime.timedelta offset: offset in timedelta format + """ + + def __init__(self, offset): + self.__offset = offset + + def utcoffset(self, dt): + return self.__offset + + def tzname(self, dt): + return str(self.__offset.total_seconds() / 3600) + + def __repr__(self): + return "".format(self.tzname(None)) + + def dst(self, dt): + return datetime.timedelta(0) + + def __getinitargs__(self): + return (self.__offset,) + + +try: + from datetime import timezone + + TZ_UTC = timezone.utc # type: ignore +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes=None): + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize(self, target_obj, data_type=None, **kwargs): + """Serialize data into a string according to type. + + :param target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises: SerializationError if serialization fails. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() + try: + attributes = target_obj._attribute_map + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized.update(target_obj.additional_properties) + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) + continue + if xml_desc.get("text", False): + serialized.text = new_attr + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = unicode_str(new_attr) + serialized.append(local_node) + else: # JSON + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened + + _new_attr = new_attr + _serialized = serialized + for k in keys: + if k not in _serialized: + _serialized.update(_new_attr) + _new_attr = _new_attr[k] + _serialized = _serialized[k] + except ValueError: + continue + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise_with_traceback(SerializationError, msg, err) + else: + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises: SerializationError if serialization fails. + :raises: ValueError if data is None + """ + + # Just in case this is a dict + internal_data_type = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) + except DeserializationError as err: + raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] + if not kwargs.get("skip_quote", False): + data = [quote(str(d), safe="") for d in data] + return str(self.serialize_iter(data, internal_data_type, **kwargs)) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises: TypeError if serialization fails. + :raises: ValueError if data is None + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError: + raise TypeError("{} must be type {}.".format(name, data_type)) + else: + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param data: The data to be serialized. + :param str data_type: The type to be serialized from. + :param bool required: Whether it's essential that the data not be + empty or None + :raises: AttributeError if required data is None. + :raises: ValueError if data is None + :raises: SerializationError if serialization fails. + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + elif data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, data.__class__) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise_with_traceback(SerializationError, msg.format(data, data_type), err) + else: + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param data: Object to be serialized. + :param str data_type: Type of object in the iterable. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + return eval(data_type)(data) # nosec + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param data: Object to be serialized. + :rtype: str + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + else: + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list attr: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param bool required: Whether the objects in the iterable must + not be None or empty. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + :rtype: list, str + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError: + serialized.append(None) + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :param bool required: Whether the objects in the dictionary must + not be None or empty. + :rtype: dict + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is unicode_str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + elif obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) + return result + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + + @staticmethod + def serialize_bytearray(attr, **kwargs): + """Serialize bytearray into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): + """Serialize Decimal object to float. + + :param attr: Object to be serialized. + :rtype: float + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): + """Serialize long (Py2) or int (Py3). + + :param attr: Object to be serialized. + :rtype: int/long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: TypeError if format invalid. + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError("RFC1123 object must be valid Datetime object.") + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises: SerializationError if format invalid. + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) + + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + + +def rest_key_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor(attr, attr_desc, data): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + # https://github.com/Azure/msrest-for-python/issues/197 + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key.""" + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + else: + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + else: # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer(object): + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes=None): + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, basestring): + return self.deserialize_data(data, response) + elif isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None: + return data + try: + attributes = response._attribute_map + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name + raise_with_traceback(DeserializationError, msg, err) + else: + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + """ + if target is None: + return None, None + + if isinstance(target, basestring): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param raw_data: Data to be processed. + :param content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param response: The response model class. + :param d_attrs: The deserialized response attributes. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [k for k, v in response._validation.items() if v.get("readonly")] + const = [k for k, v in response._validation.items() if v.get("constant")] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + raise DeserializationError(msg + str(err)) + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) + + def deserialize_data(self, data, data_type): + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises: DeserializationError if deserialization fails. + :return: Deserialized object. + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise_with_traceback(DeserializationError, msg, err) + else: + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :rtype: dict + :raises: TypeError if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, basestring): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + else: + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :rtype: str, int, float or bool + :raises: TypeError if string format is not valid. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + else: + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + elif isinstance(attr, basestring): + if attr.lower() in ["true", "1"]: + return True + elif attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + return eval(data_type)(attr) # nosec + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): + return data + except NameError: + return str(data) + else: + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + # https://github.com/Azure/azure-rest-api-specs/issues/141 + try: + return list(enum_obj.__members__.values())[data] + except IndexError: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) + attr = attr + padding + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :rtype: Decimal + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(attr) + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise_with_traceback(DeserializationError, msg, err) + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :rtype: long or int + :raises: ValueError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :rtype: TimeDelta + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise_with_traceback(DeserializationError, msg, err) + else: + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :rtype: Date + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: Datetime + :raises: DeserializationError if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py index 138f663c53a4e..9aad73fc743e7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_vendor.py @@ -7,6 +7,7 @@ from azure.core.pipeline.transport import HttpRequest + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -14,6 +15,7 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -21,7 +23,5 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py index 34ea7990c4b4a..e5754a47ce68f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py index 1b19979c9ceed..b0c9e9eacd21e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py @@ -7,9 +7,15 @@ # -------------------------------------------------------------------------- from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient -__all__ = ['RecoveryServicesBackupPassiveClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = ["RecoveryServicesBackupPassiveClient"] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py index 788c7f059d6c5..6269cd3efc88c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py @@ -25,23 +25,18 @@ class RecoveryServicesBackupPassiveClientConfiguration(Configuration): # pylint 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. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str :keyword api_version: Api Version. Default value is "2021-11-15". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupPassiveClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + api_version = kwargs.pop("api_version", "2021-11-15") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +46,21 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicesbackup/{}".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') + 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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_patch.py index 0de9ec4631263..f906bb7c0e0a8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_patch.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_patch.py @@ -27,13 +27,17 @@ from typing import Any, TYPE_CHECKING import importlib from .._patch import DUPLICATE_PARAMS_POLICY -from ._recovery_services_backup_passive_client import RecoveryServicesBackupPassiveClient as RecoveryServicesBackupPassiveClientGenerated +from ._recovery_services_backup_passive_client import ( + RecoveryServicesBackupPassiveClient as RecoveryServicesBackupPassiveClientGenerated, +) if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential + class RecoveryServicesBackupPassiveClient(RecoveryServicesBackupPassiveClientGenerated): __doc__ = RecoveryServicesBackupPassiveClientGenerated.__doc__ + def __init__( self, credential: "AsyncTokenCredential", @@ -54,6 +58,7 @@ def __init__( **kwargs ) + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py index c2cf1c2de13bb..439b1564f7117 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py @@ -9,20 +9,32 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models +from .._serialization import Deserializer, Serializer from ._configuration import RecoveryServicesBackupPassiveClientConfiguration -from .operations import AadPropertiesOperations, BackupCrrJobDetailsOperations, BackupCrrJobsOperations, BackupProtectedItemsCrrOperations, BackupResourceStorageConfigsOperations, BackupUsageSummariesCRROperations, CrossRegionRestoreOperations, CrrOperationResultsOperations, CrrOperationStatusOperations, RecoveryPointsCrrOperations, RecoveryPointsOperations +from .operations import ( + AadPropertiesOperations, + BackupCrrJobDetailsOperations, + BackupCrrJobsOperations, + BackupProtectedItemsCrrOperations, + BackupResourceStorageConfigsOperations, + BackupUsageSummariesCRROperations, + CrossRegionRestoreOperations, + CrrOperationResultsOperations, + CrrOperationStatusOperations, + RecoveryPointsCrrOperations, + RecoveryPointsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instance-attributes + +class RecoveryServicesBackupPassiveClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_usage_summaries_crr: BackupUsageSummariesCRROperations operations @@ -58,9 +70,9 @@ class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instanc :ivar backup_protected_items_crr: BackupProtectedItemsCrrOperations operations :vartype backup_protected_items_crr: azure.mgmt.recoveryservicesbackup.passivestamp.aio.operations.BackupProtectedItemsCrrOperations - :param credential: Credential needed for the client to connect to Azure. + :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription Id. + :param subscription_id: The subscription Id. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str @@ -78,31 +90,44 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = RecoveryServicesBackupPassiveClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._config = RecoveryServicesBackupPassiveClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.backup_usage_summaries_crr = BackupUsageSummariesCRROperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_usage_summaries_crr = BackupUsageSummariesCRROperations( + self._client, self._config, self._serialize, self._deserialize + ) self.aad_properties = AadPropertiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.cross_region_restore = CrossRegionRestoreOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_crr_job_details = BackupCrrJobDetailsOperations(self._client, self._config, self._serialize, self._deserialize) + self.cross_region_restore = CrossRegionRestoreOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_crr_job_details = BackupCrrJobDetailsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.backup_crr_jobs = BackupCrrJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.crr_operation_results = CrrOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.crr_operation_status = CrrOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.crr_operation_results = CrrOperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.crr_operation_status = CrrOperationStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_resource_storage_configs = BackupResourceStorageConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.recovery_points_crr = RecoveryPointsCrrOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_protected_items_crr = BackupProtectedItemsCrrOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.backup_resource_storage_configs = BackupResourceStorageConfigsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.recovery_points_crr = RecoveryPointsCrrOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_protected_items_crr = BackupProtectedItemsCrrOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -111,7 +136,7 @@ def _send_request( >>> response = await client._send_request(request) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py index 7ac30ce43fb34..cc07a4210734f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py @@ -18,16 +18,22 @@ from ._recovery_points_crr_operations import RecoveryPointsCrrOperations from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'BackupUsageSummariesCRROperations', - 'AadPropertiesOperations', - 'CrossRegionRestoreOperations', - 'BackupCrrJobDetailsOperations', - 'BackupCrrJobsOperations', - 'CrrOperationResultsOperations', - 'CrrOperationStatusOperations', - 'RecoveryPointsOperations', - 'BackupResourceStorageConfigsOperations', - 'RecoveryPointsCrrOperations', - 'BackupProtectedItemsCrrOperations', + "BackupUsageSummariesCRROperations", + "AadPropertiesOperations", + "CrossRegionRestoreOperations", + "BackupCrrJobDetailsOperations", + "BackupCrrJobsOperations", + "CrrOperationResultsOperations", + "CrrOperationStatusOperations", + "RecoveryPointsOperations", + "BackupResourceStorageConfigsOperations", + "RecoveryPointsCrrOperations", + "BackupProtectedItemsCrrOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py index 8a6e4af07ba92..54f0e572b68c7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py @@ -8,85 +8,89 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._aad_properties_operations import build_get_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AadPropertiesOperations: - """AadPropertiesOperations 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. +class AadPropertiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`aad_properties` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - azure_region: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.AADPropertiesResource": + self, azure_region: str, filter: Optional[str] = None, **kwargs: Any + ) -> _models.AADPropertiesResource: """Fetches the AAD properties from target region BCM stamp. Fetches the AAD properties from target region BCM stamp. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AADPropertiesResource, or the result of cls(response) + :return: AADPropertiesResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AADPropertiesResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AADPropertiesResource] - request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.get.metadata['url'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,12 +98,11 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AADPropertiesResource', pipeline_response) + deserialized = self._deserialize("AADPropertiesResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py index c1ba7e8193eb7..b8d4b044f5b3e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py @@ -6,73 +6,133 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_crr_job_details_operations import build_get_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupCrrJobDetailsOperations: - """BackupCrrJobDetailsOperations 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. +class BackupCrrJobDetailsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_crr_job_details` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @overload async def get( self, azure_region: str, - parameters: "_models.CrrJobRequest", + parameters: _models.CrrJobRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.JobResource": + ) -> _models.JobResource: """Get CRR job details from target region. Get CRR job details from target region. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: CRR Job request. + :param parameters: CRR Job request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.JobResource: + """Get CRR job details from target region. + + Get CRR job details from target region. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: CRR Job request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JobResource, or the result of cls(response) + :return: JobResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + @distributed_trace_async + async def get( + self, azure_region: str, parameters: Union[_models.CrrJobRequest, IO], **kwargs: Any + ) -> _models.JobResource: + """Get CRR job details from target region. - _json = self._serialize.body(parameters, 'CrrJobRequest') + Get CRR job details from target region. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: CRR Job request. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrrJobRequest") request = build_get_request( azure_region=azure_region, @@ -80,16 +140,18 @@ async def get( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get.metadata['url'], + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,12 +159,11 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('JobResource', pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py index c66b041be077f..c2059ef0ef0db 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py @@ -6,111 +6,125 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_crr_jobs_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupCrrJobsOperations: - """BackupCrrJobsOperations 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. +class BackupCrrJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_crr_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( self, azure_region: str, - parameters: "_models.CrrJobRequest", + parameters: Union[_models.CrrJobRequest, IO], filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.JobResourceList"]: + ) -> AsyncIterable["_models.JobResource"]: """Gets the list of CRR jobs from the target region. Gets the list of CRR jobs from the target region. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Backup CRR Job request. - :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest + :param parameters: Backup CRR Job request. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest or IO :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobResourceList or the result of cls(response) + :return: An iterator like instance of either JobResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - _json = self._serialize.body(parameters, 'CrrJobRequest') - + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrrJobRequest") + request = build_list_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, api_version=api_version, content_type=content_type, json=_json, - filter=filter, - skip_token=skip_token, - template_url=self.list.metadata['url'], + content=_content, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - _json = self._serialize.body(parameters, 'CrrJobRequest') - - request = build_list_request( - azure_region=azure_region, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,10 +138,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -138,8 +150,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py index 78a047c95d36b..6c4043f6f66e0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py @@ -7,42 +7,49 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protected_items_crr_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupProtectedItemsCrrOperations: - """BackupProtectedItemsCrrOperations 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. +class BackupProtectedItemsCrrOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_protected_items_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,60 +59,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ProtectedItemResourceList"]: + ) -> AsyncIterable["_models.ProtectedItemResource"]: """Provides a pageable list of all items that are backed up within a vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectedItemResourceList or the result of + :return: An iterator like instance of either ProtectedItemResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,8 +137,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py index 674258d525f3e..65934d211c62f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py @@ -6,86 +6,94 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._backup_resource_storage_configs_operations import build_get_request, build_patch_request, build_update_request -T = TypeVar('T') +from ...operations._backup_resource_storage_configs_operations import ( + build_get_request, + build_patch_request, + build_update_request, +) + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupResourceStorageConfigsOperations: - """BackupResourceStorageConfigsOperations 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. +class BackupResourceStorageConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_resource_storage_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + self, vault_name: str, resource_group_name: str, **kwargs: Any + ) -> _models.BackupResourceConfigResource: """Fetches resource storage config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,49 +101,115 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + + @overload + async def update( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def update( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + ) -> _models.BackupResourceConfigResource: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_update_request( vault_name=vault_name, @@ -144,16 +218,18 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,49 +237,115 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + + @overload + async def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any ) -> None: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_patch_request( vault_name=vault_name, @@ -212,16 +354,18 @@ async def patch( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.patch.metadata['url'], + content=_content, + template_url=self.patch.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -232,5 +376,4 @@ async def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore - + patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py index 98cf725a5206f..aeec2050376bb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py @@ -7,42 +7,49 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_usage_summaries_crr_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BackupUsageSummariesCRROperations: - """BackupUsageSummariesCRROperations 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. +class BackupUsageSummariesCRROperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_usage_summaries_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -52,60 +59,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.BackupManagementUsageList"]: + ) -> AsyncIterable["_models.BackupManagementUsage"]: """Fetches the backup management usage summaries of the vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupManagementUsageList or the result of + :return: An iterator like instance of either BackupManagementUsage or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsageList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,10 +125,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -133,8 +137,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py index 89cb89b4e68fc..169b219939720 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py @@ -6,95 +6,109 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request -from ...operations._cross_region_restore_operations import build_trigger_request_initial -T = TypeVar('T') +from ...operations._cross_region_restore_operations import build_trigger_request + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CrossRegionRestoreOperations: - """CrossRegionRestoreOperations 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. +class CrossRegionRestoreOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`cross_region_restore` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _trigger_initial( # pylint: disable=inconsistent-return-statements - self, - azure_region: str, - parameters: "_models.CrossRegionRestoreRequest", - **kwargs: Any + self, azure_region: str, parameters: Union[_models.CrossRegionRestoreRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'CrossRegionRestoreRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreRequest") - request = build_trigger_request_initial( + request = build_trigger_request( azure_region=azure_region, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._trigger_initial.metadata['url'], + content=_content, + template_url=self._trigger_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore - + _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore - @distributed_trace_async - async def begin_trigger( # pylint: disable=inconsistent-return-statements + @overload + async def begin_trigger( self, azure_region: str, - parameters: "_models.CrossRegionRestoreRequest", + parameters: _models.CrossRegionRestoreRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Restores the specified backed up data in a different region as compared to where the data is @@ -103,11 +117,14 @@ async def begin_trigger( # pylint: disable=inconsistent-return-statements Restores the specified backed up data in a different region as compared to where the data is backed up. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: resource cross region restore request. + :param parameters: resource cross region restore request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrossRegionRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -118,43 +135,112 @@ async def begin_trigger( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + async def begin_trigger( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores the specified backed up data in a different region as compared to where the data is + backed up. + + Restores the specified backed up data in a different region as compared to where the data is + backed up. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: resource cross region restore request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger( + self, azure_region: str, parameters: Union[_models.CrossRegionRestoreRequest, IO], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores the specified backed up data in a different region as compared to where the data is + backed up. + + Restores the specified backed up data in a different region as compared to where the data is + backed up. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: resource cross region restore request. Is either a model type or a IO type. + Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrossRegionRestoreRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + 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( + raw_result = await self._trigger_initial( # type: ignore azure_region=azure_region, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore + begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py index 8a5f7e0c807e9..730e3785f4800 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py @@ -8,83 +8,87 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._crr_operation_results_operations import build_get_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CrrOperationResultsOperations: - """CrrOperationResultsOperations 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. +class CrrOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`crr_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( # pylint: disable=inconsistent-return-statements - self, - azure_region: str, - operation_id: str, - **kwargs: Any + self, azure_region: str, operation_id: str, **kwargs: Any ) -> None: """get. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( azure_region=azure_region, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -95,5 +99,4 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py index d1d6219543fed..77ce39fdead45 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py @@ -8,83 +8,85 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._crr_operation_status_operations import build_get_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CrrOperationStatusOperations: - """CrrOperationStatusOperations 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. +class CrrOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`crr_operation_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get( - self, - azure_region: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.OperationStatus: """get. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( azure_region=azure_region, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,12 +94,11 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py index 0f5ee85efecb8..258dd92e1aaa4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py @@ -7,42 +7,49 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from urllib.parse import parse_qs, urljoin, urlparse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._recovery_points_crr_operations import build_list_request -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RecoveryPointsCrrOperations: - """RecoveryPointsCrrOperations 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. +class RecoveryPointsCrrOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`recovery_points_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -54,68 +61,65 @@ def list( protected_item_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RecoveryPointResourceList"]: + ) -> AsyncIterable["_models.RecoveryPointResource"]: """Lists the backup copies for the backed up item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item whose backup copies are to be fetched. + :param protected_item_name: Backed up item whose backup copies are to be fetched. Required. :type protected_item_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointResourceList or the result of + :return: An iterator like instance of either RecoveryPointResource or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - protected_item_name=protected_item_name, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -129,10 +133,8 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -143,8 +145,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py index a1851f1f4408f..36179767ef9f4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py @@ -6,42 +6,132 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_access_token_request -T = TypeVar('T') + +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. +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.recoveryservicesbackup.passivestamp.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.aio.RecoveryServicesBackupPassiveClient`'s + :attr:`recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def get_access_token( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: _models.AADPropertiesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CrrAccessTokenResource: + """Returns the Access token for communication between BMS and Protection service. + + Returns the Access token for communication between BMS and Protection service. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container. Required. + :type container_name: str + :param protected_item_name: Name of the Protected Item. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery Point Id. Required. + :type recovery_point_id: str + :param parameters: Get Access Token request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CrrAccessTokenResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_access_token( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CrrAccessTokenResource: + """Returns the Access token for communication between BMS and Protection service. + + Returns the Access token for communication between BMS and Protection service. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container. Required. + :type container_name: str + :param protected_item_name: Name of the Protected Item. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery Point Id. Required. + :type recovery_point_id: str + :param parameters: Get Access Token request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CrrAccessTokenResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def get_access_token( @@ -52,65 +142,83 @@ async def get_access_token( container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.AADPropertiesResource", + parameters: Union[_models.AADPropertiesResource, IO], **kwargs: Any - ) -> "_models.CrrAccessTokenResource": + ) -> _models.CrrAccessTokenResource: """Returns the Access token for communication between BMS and Protection service. Returns the Access token for communication between BMS and Protection service. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container. + :param container_name: Name of the container. Required. :type container_name: str - :param protected_item_name: Name of the Protected Item. + :param protected_item_name: Name of the Protected Item. Required. :type protected_item_name: str - :param recovery_point_id: Recovery Point Id. + :param recovery_point_id: Recovery Point Id. Required. :type recovery_point_id: str - :param parameters: Get Access Token request. + :param parameters: Get Access Token request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CrrAccessTokenResource, or the result of cls(response) + :return: CrrAccessTokenResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CrrAccessTokenResource"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'AADPropertiesResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CrrAccessTokenResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AADPropertiesResource") request = build_get_access_token_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.get_access_token.metadata['url'], + content=_content, + template_url=self.get_access_token.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,12 +226,11 @@ async def get_access_token( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CrrAccessTokenResource', pipeline_response) + deserialized = self._deserialize("CrrAccessTokenResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore - + get_access_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py index 3f661f19e9a9f..1536b2168d82a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py @@ -128,190 +128,192 @@ from ._models_py3 import TargetRestoreInfo from ._models_py3 import WorkloadCrrAccessToken - -from ._recovery_services_backup_passive_client_enums import ( - BackupManagementType, - CopyOptions, - CreateMode, - DataSourceType, - HealthState, - HealthStatus, - JobOperationType, - JobStatus, - JobSupportedAction, - LastBackupStatus, - MabServerType, - OperationStatusValues, - OverwriteOptions, - ProtectedItemHealthStatus, - ProtectedItemState, - ProtectionState, - RecoveryMode, - RecoveryPointTierStatus, - RecoveryPointTierType, - RecoveryType, - ResourceHealthStatus, - RestorePointQueryType, - RestorePointType, - RestoreRequestType, - SQLDataDirectoryType, - StorageType, - StorageTypeState, - Type, - UsagesUnit, - WorkloadType, -) +from ._recovery_services_backup_passive_client_enums import BackupManagementType +from ._recovery_services_backup_passive_client_enums import CopyOptions +from ._recovery_services_backup_passive_client_enums import CreateMode +from ._recovery_services_backup_passive_client_enums import DataSourceType +from ._recovery_services_backup_passive_client_enums import HealthState +from ._recovery_services_backup_passive_client_enums import HealthStatus +from ._recovery_services_backup_passive_client_enums import JobOperationType +from ._recovery_services_backup_passive_client_enums import JobStatus +from ._recovery_services_backup_passive_client_enums import JobSupportedAction +from ._recovery_services_backup_passive_client_enums import LastBackupStatus +from ._recovery_services_backup_passive_client_enums import MabServerType +from ._recovery_services_backup_passive_client_enums import OperationStatusValues +from ._recovery_services_backup_passive_client_enums import OverwriteOptions +from ._recovery_services_backup_passive_client_enums import ProtectedItemHealthStatus +from ._recovery_services_backup_passive_client_enums import ProtectedItemState +from ._recovery_services_backup_passive_client_enums import ProtectionState +from ._recovery_services_backup_passive_client_enums import RecoveryMode +from ._recovery_services_backup_passive_client_enums import RecoveryPointTierStatus +from ._recovery_services_backup_passive_client_enums import RecoveryPointTierType +from ._recovery_services_backup_passive_client_enums import RecoveryType +from ._recovery_services_backup_passive_client_enums import ResourceHealthStatus +from ._recovery_services_backup_passive_client_enums import RestorePointQueryType +from ._recovery_services_backup_passive_client_enums import RestorePointType +from ._recovery_services_backup_passive_client_enums import RestoreRequestType +from ._recovery_services_backup_passive_client_enums import SQLDataDirectoryType +from ._recovery_services_backup_passive_client_enums import StorageType +from ._recovery_services_backup_passive_client_enums import StorageTypeState +from ._recovery_services_backup_passive_client_enums import Type +from ._recovery_services_backup_passive_client_enums import UsagesUnit +from ._recovery_services_backup_passive_client_enums import WorkloadType +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'AADProperties', - 'AADPropertiesResource', - 'AzureFileShareRecoveryPoint', - 'AzureFileShareRestoreRequest', - 'AzureFileshareProtectedItem', - 'AzureFileshareProtectedItemExtendedInfo', - 'AzureIaaSClassicComputeVMProtectedItem', - 'AzureIaaSComputeVMProtectedItem', - 'AzureIaaSVMErrorInfo', - 'AzureIaaSVMHealthDetails', - 'AzureIaaSVMJob', - 'AzureIaaSVMJobExtendedInfo', - 'AzureIaaSVMJobTaskDetails', - 'AzureIaaSVMProtectedItem', - 'AzureIaaSVMProtectedItemExtendedInfo', - 'AzureSqlProtectedItem', - 'AzureSqlProtectedItemExtendedInfo', - 'AzureStorageErrorInfo', - 'AzureStorageJob', - 'AzureStorageJobExtendedInfo', - 'AzureStorageJobTaskDetails', - 'AzureVmWorkloadProtectedItem', - 'AzureVmWorkloadProtectedItemExtendedInfo', - 'AzureVmWorkloadSAPAseDatabaseProtectedItem', - 'AzureVmWorkloadSAPHanaDatabaseProtectedItem', - 'AzureVmWorkloadSQLDatabaseProtectedItem', - 'AzureWorkloadErrorInfo', - 'AzureWorkloadJob', - 'AzureWorkloadJobExtendedInfo', - 'AzureWorkloadJobTaskDetails', - 'AzureWorkloadPointInTimeRecoveryPoint', - 'AzureWorkloadPointInTimeRestoreRequest', - 'AzureWorkloadRecoveryPoint', - 'AzureWorkloadRestoreRequest', - 'AzureWorkloadSAPHanaPointInTimeRecoveryPoint', - 'AzureWorkloadSAPHanaPointInTimeRestoreRequest', - 'AzureWorkloadSAPHanaRecoveryPoint', - 'AzureWorkloadSAPHanaRestoreRequest', - 'AzureWorkloadSQLPointInTimeRecoveryPoint', - 'AzureWorkloadSQLPointInTimeRestoreRequest', - 'AzureWorkloadSQLRecoveryPoint', - 'AzureWorkloadSQLRecoveryPointExtendedInfo', - 'AzureWorkloadSQLRestoreRequest', - 'BEKDetails', - 'BMSAADPropertiesQueryObject', - 'BMSBackupSummariesQueryObject', - 'BMSRPQueryObject', - 'BackupManagementUsage', - 'BackupManagementUsageList', - 'BackupResourceConfig', - 'BackupResourceConfigResource', - 'ClientScriptForConnect', - 'CrossRegionRestoreRequest', - 'CrossRegionRestoreRequestResource', - 'CrrAccessToken', - 'CrrAccessTokenResource', - 'CrrJobRequest', - 'CrrJobRequestResource', - 'DPMProtectedItem', - 'DPMProtectedItemExtendedInfo', - 'DiskExclusionProperties', - 'DiskInformation', - 'DpmErrorInfo', - 'DpmJob', - 'DpmJobExtendedInfo', - 'DpmJobTaskDetails', - 'EncryptionDetails', - 'ErrorAdditionalInfo', - 'ErrorDetail', - 'ExtendedProperties', - 'GenericProtectedItem', - 'GenericRecoveryPoint', - 'IaasVMRecoveryPoint', - 'IaasVMRestoreRequest', - 'IdentityBasedRestoreDetails', - 'IdentityInfo', - 'InstantItemRecoveryTarget', - 'Job', - 'JobQueryObject', - 'JobResource', - 'JobResourceList', - 'KEKDetails', - 'KPIResourceHealthDetails', - 'KeyAndSecretDetails', - 'MabErrorInfo', - 'MabFileFolderProtectedItem', - 'MabFileFolderProtectedItemExtendedInfo', - 'MabJob', - 'MabJobExtendedInfo', - 'MabJobTaskDetails', - 'NameInfo', - 'NewErrorResponse', - 'NewErrorResponseError', - 'OperationStatus', - 'OperationStatusError', - 'OperationStatusExtendedInfo', - 'OperationStatusJobExtendedInfo', - 'OperationStatusJobsExtendedInfo', - 'OperationStatusProvisionILRExtendedInfo', - 'OperationStatusRecoveryPointExtendedInfo', - 'PointInTimeRange', - 'ProtectedItem', - 'ProtectedItemQueryObject', - 'ProtectedItemResource', - 'ProtectedItemResourceList', - 'RecoveryPoint', - 'RecoveryPointDiskConfiguration', - 'RecoveryPointMoveReadinessInfo', - 'RecoveryPointResource', - 'RecoveryPointResourceList', - 'RecoveryPointTierInformation', - 'Resource', - 'ResourceHealthDetails', - 'ResourceList', - 'RestoreFileSpecs', - 'RestoreRequest', - 'SQLDataDirectory', - 'SQLDataDirectoryMapping', - 'TargetAFSRestoreInfo', - 'TargetRestoreInfo', - 'WorkloadCrrAccessToken', - 'BackupManagementType', - 'CopyOptions', - 'CreateMode', - 'DataSourceType', - 'HealthState', - 'HealthStatus', - 'JobOperationType', - 'JobStatus', - 'JobSupportedAction', - 'LastBackupStatus', - 'MabServerType', - 'OperationStatusValues', - 'OverwriteOptions', - 'ProtectedItemHealthStatus', - 'ProtectedItemState', - 'ProtectionState', - 'RecoveryMode', - 'RecoveryPointTierStatus', - 'RecoveryPointTierType', - 'RecoveryType', - 'ResourceHealthStatus', - 'RestorePointQueryType', - 'RestorePointType', - 'RestoreRequestType', - 'SQLDataDirectoryType', - 'StorageType', - 'StorageTypeState', - 'Type', - 'UsagesUnit', - 'WorkloadType', + "AADProperties", + "AADPropertiesResource", + "AzureFileShareRecoveryPoint", + "AzureFileShareRestoreRequest", + "AzureFileshareProtectedItem", + "AzureFileshareProtectedItemExtendedInfo", + "AzureIaaSClassicComputeVMProtectedItem", + "AzureIaaSComputeVMProtectedItem", + "AzureIaaSVMErrorInfo", + "AzureIaaSVMHealthDetails", + "AzureIaaSVMJob", + "AzureIaaSVMJobExtendedInfo", + "AzureIaaSVMJobTaskDetails", + "AzureIaaSVMProtectedItem", + "AzureIaaSVMProtectedItemExtendedInfo", + "AzureSqlProtectedItem", + "AzureSqlProtectedItemExtendedInfo", + "AzureStorageErrorInfo", + "AzureStorageJob", + "AzureStorageJobExtendedInfo", + "AzureStorageJobTaskDetails", + "AzureVmWorkloadProtectedItem", + "AzureVmWorkloadProtectedItemExtendedInfo", + "AzureVmWorkloadSAPAseDatabaseProtectedItem", + "AzureVmWorkloadSAPHanaDatabaseProtectedItem", + "AzureVmWorkloadSQLDatabaseProtectedItem", + "AzureWorkloadErrorInfo", + "AzureWorkloadJob", + "AzureWorkloadJobExtendedInfo", + "AzureWorkloadJobTaskDetails", + "AzureWorkloadPointInTimeRecoveryPoint", + "AzureWorkloadPointInTimeRestoreRequest", + "AzureWorkloadRecoveryPoint", + "AzureWorkloadRestoreRequest", + "AzureWorkloadSAPHanaPointInTimeRecoveryPoint", + "AzureWorkloadSAPHanaPointInTimeRestoreRequest", + "AzureWorkloadSAPHanaRecoveryPoint", + "AzureWorkloadSAPHanaRestoreRequest", + "AzureWorkloadSQLPointInTimeRecoveryPoint", + "AzureWorkloadSQLPointInTimeRestoreRequest", + "AzureWorkloadSQLRecoveryPoint", + "AzureWorkloadSQLRecoveryPointExtendedInfo", + "AzureWorkloadSQLRestoreRequest", + "BEKDetails", + "BMSAADPropertiesQueryObject", + "BMSBackupSummariesQueryObject", + "BMSRPQueryObject", + "BackupManagementUsage", + "BackupManagementUsageList", + "BackupResourceConfig", + "BackupResourceConfigResource", + "ClientScriptForConnect", + "CrossRegionRestoreRequest", + "CrossRegionRestoreRequestResource", + "CrrAccessToken", + "CrrAccessTokenResource", + "CrrJobRequest", + "CrrJobRequestResource", + "DPMProtectedItem", + "DPMProtectedItemExtendedInfo", + "DiskExclusionProperties", + "DiskInformation", + "DpmErrorInfo", + "DpmJob", + "DpmJobExtendedInfo", + "DpmJobTaskDetails", + "EncryptionDetails", + "ErrorAdditionalInfo", + "ErrorDetail", + "ExtendedProperties", + "GenericProtectedItem", + "GenericRecoveryPoint", + "IaasVMRecoveryPoint", + "IaasVMRestoreRequest", + "IdentityBasedRestoreDetails", + "IdentityInfo", + "InstantItemRecoveryTarget", + "Job", + "JobQueryObject", + "JobResource", + "JobResourceList", + "KEKDetails", + "KPIResourceHealthDetails", + "KeyAndSecretDetails", + "MabErrorInfo", + "MabFileFolderProtectedItem", + "MabFileFolderProtectedItemExtendedInfo", + "MabJob", + "MabJobExtendedInfo", + "MabJobTaskDetails", + "NameInfo", + "NewErrorResponse", + "NewErrorResponseError", + "OperationStatus", + "OperationStatusError", + "OperationStatusExtendedInfo", + "OperationStatusJobExtendedInfo", + "OperationStatusJobsExtendedInfo", + "OperationStatusProvisionILRExtendedInfo", + "OperationStatusRecoveryPointExtendedInfo", + "PointInTimeRange", + "ProtectedItem", + "ProtectedItemQueryObject", + "ProtectedItemResource", + "ProtectedItemResourceList", + "RecoveryPoint", + "RecoveryPointDiskConfiguration", + "RecoveryPointMoveReadinessInfo", + "RecoveryPointResource", + "RecoveryPointResourceList", + "RecoveryPointTierInformation", + "Resource", + "ResourceHealthDetails", + "ResourceList", + "RestoreFileSpecs", + "RestoreRequest", + "SQLDataDirectory", + "SQLDataDirectoryMapping", + "TargetAFSRestoreInfo", + "TargetRestoreInfo", + "WorkloadCrrAccessToken", + "BackupManagementType", + "CopyOptions", + "CreateMode", + "DataSourceType", + "HealthState", + "HealthStatus", + "JobOperationType", + "JobStatus", + "JobSupportedAction", + "LastBackupStatus", + "MabServerType", + "OperationStatusValues", + "OverwriteOptions", + "ProtectedItemHealthStatus", + "ProtectedItemState", + "ProtectionState", + "RecoveryMode", + "RecoveryPointTierStatus", + "RecoveryPointTierType", + "RecoveryType", + "ResourceHealthStatus", + "RestorePointQueryType", + "RestorePointType", + "RestoreRequestType", + "SQLDataDirectoryType", + "StorageType", + "StorageTypeState", + "Type", + "UsagesUnit", + "WorkloadType", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py index e405dd73cdbf4..e36298d0b708c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py @@ -1,4 +1,5 @@ # coding=utf-8 +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,15 +8,16 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from .. import _serialization -from ._recovery_services_backup_passive_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models -class AADProperties(msrest.serialization.Model): +class AADProperties(_serialization.Model): """AADProperties. :ivar service_principal_client_id: @@ -31,11 +33,11 @@ class AADProperties(msrest.serialization.Model): """ _attribute_map = { - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'authority': {'key': 'authority', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, + "service_principal_client_id": {"key": "servicePrincipalClientId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "authority": {"key": "authority", "type": "str"}, + "audience": {"key": "audience", "type": "str"}, + "service_principal_object_id": {"key": "servicePrincipalObjectId", "type": "str"}, } def __init__( @@ -60,7 +62,7 @@ def __init__( :keyword service_principal_object_id: :paramtype service_principal_object_id: str """ - super(AADProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.service_principal_client_id = service_principal_client_id self.tenant_id = tenant_id self.authority = authority @@ -68,7 +70,7 @@ def __init__( self.service_principal_object_id = service_principal_object_id -class Resource(msrest.serialization.Model): +class Resource(_serialization.Model): """ARM Resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -82,25 +84,25 @@ class Resource(msrest.serialization.Model): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, } def __init__( @@ -114,12 +116,12 @@ def __init__( """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str """ - super(Resource, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = None self.name = None self.type = None @@ -142,7 +144,7 @@ class AADPropertiesResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -151,19 +153,19 @@ class AADPropertiesResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'AADProperties'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "AADProperties"}, } def __init__( @@ -172,41 +174,42 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["AADProperties"] = None, + properties: Optional["_models.AADProperties"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: AADPropertiesResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADProperties """ - super(AADPropertiesResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class ProtectedItem(msrest.serialization.Model): +class ProtectedItem(_serialization.Model): # pylint: disable=too-many-instance-attributes """Base class for backup items. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileshareProtectedItem, AzureIaaSVMProtectedItem, AzureVmWorkloadProtectedItem, DPMProtectedItem, GenericProtectedItem, MabFileFolderProtectedItem, AzureSqlProtectedItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileshareProtectedItem, AzureIaaSVMProtectedItem, AzureVmWorkloadProtectedItem, + DPMProtectedItem, GenericProtectedItem, MabFileFolderProtectedItem, AzureSqlProtectedItem All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -222,7 +225,7 @@ class ProtectedItem(msrest.serialization.Model): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -243,42 +246,50 @@ class ProtectedItem(msrest.serialization.Model): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, } _subtype_map = { - 'protected_item_type': {'AzureFileShareProtectedItem': 'AzureFileshareProtectedItem', 'AzureIaaSVMProtectedItem': 'AzureIaaSVMProtectedItem', 'AzureVmWorkloadProtectedItem': 'AzureVmWorkloadProtectedItem', 'DPMProtectedItem': 'DPMProtectedItem', 'GenericProtectedItem': 'GenericProtectedItem', 'MabFileFolderProtectedItem': 'MabFileFolderProtectedItem', 'Microsoft.Sql/servers/databases': 'AzureSqlProtectedItem'} + "protected_item_type": { + "AzureFileShareProtectedItem": "AzureFileshareProtectedItem", + "AzureIaaSVMProtectedItem": "AzureIaaSVMProtectedItem", + "AzureVmWorkloadProtectedItem": "AzureVmWorkloadProtectedItem", + "DPMProtectedItem": "DPMProtectedItem", + "GenericProtectedItem": "GenericProtectedItem", + "MabFileFolderProtectedItem": "MabFileFolderProtectedItem", + "Microsoft.Sql/servers/databases": "AzureSqlProtectedItem", + } } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -288,15 +299,15 @@ def __init__( **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -311,7 +322,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -332,7 +343,7 @@ def __init__( will be performed. :paramtype resource_guard_operation_requests: list[str] """ - super(ProtectedItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.protected_item_type = None # type: Optional[str] self.backup_management_type = backup_management_type self.workload_type = workload_type @@ -350,21 +361,21 @@ def __init__( self.resource_guard_operation_requests = resource_guard_operation_requests -class AzureFileshareProtectedItem(ProtectedItem): +class AzureFileshareProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Azure File Share workload-specific backup item. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -380,7 +391,7 @@ class AzureFileshareProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -402,12 +413,12 @@ class AzureFileshareProtectedItem(ProtectedItem): :vartype friendly_name: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :ivar health_status: backups running status for this backup item. Possible values include: - "Passed", "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: backups running status for this backup item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. @@ -423,46 +434,46 @@ class AzureFileshareProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureFileshareProtectedItemExtendedInfo'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "extended_info": {"key": "extendedInfo", "type": "AzureFileshareProtectedItemExtendedInfo"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -471,24 +482,24 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, friendly_name: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_status: Optional[Union[str, "_models.HealthStatus"]] = None, last_backup_status: Optional[str] = None, last_backup_time: Optional[datetime.datetime] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, - extended_info: Optional["AzureFileshareProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, + extended_info: Optional["_models.AzureFileshareProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -503,7 +514,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -527,13 +538,12 @@ def __init__( :paramtype friendly_name: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :keyword health_status: backups running status for this backup item. Possible values include: - "Passed", "ActionRequired", "ActionSuggested", "Invalid". + :keyword health_status: backups running status for this backup item. Known values are: + "Passed", "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. @@ -547,8 +557,24 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AzureFileshareProtectedItemExtendedInfo """ - super(AzureFileshareProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'AzureFileShareProtectedItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "AzureFileShareProtectedItem" # type: str self.friendly_name = friendly_name self.protection_status = protection_status self.protection_state = protection_state @@ -559,7 +585,7 @@ def __init__( self.extended_info = extended_info -class AzureFileshareProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureFileshareProtectedItemExtendedInfo(_serialization.Model): """Additional information about Azure File Share backup item. Variables are only populated by the server, and will be ignored when sending a request. @@ -579,16 +605,16 @@ class AzureFileshareProtectedItemExtendedInfo(msrest.serialization.Model): """ _validation = { - 'resource_state': {'readonly': True}, - 'resource_state_sync_time': {'readonly': True}, + "resource_state": {"readonly": True}, + "resource_state_sync_time": {"readonly": True}, } _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, - 'resource_state': {'key': 'resourceState', 'type': 'str'}, - 'resource_state_sync_time': {'key': 'resourceStateSyncTime', 'type': 'iso-8601'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_state": {"key": "policyState", "type": "str"}, + "resource_state": {"key": "resourceState", "type": "str"}, + "resource_state_sync_time": {"key": "resourceStateSyncTime", "type": "iso-8601"}, } def __init__( @@ -609,7 +635,7 @@ def __init__( item. :paramtype policy_state: str """ - super(AzureFileshareProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count self.policy_state = policy_state @@ -617,38 +643,40 @@ def __init__( self.resource_state_sync_time = None -class RecoveryPoint(msrest.serialization.Model): +class RecoveryPoint(_serialization.Model): """Base class for backup copies. Workload-specific backup copies are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareRecoveryPoint, AzureWorkloadRecoveryPoint, GenericRecoveryPoint, IaasVMRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareRecoveryPoint, AzureWorkloadRecoveryPoint, GenericRecoveryPoint, + IaasVMRecoveryPoint All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureFileShareRecoveryPoint': 'AzureFileShareRecoveryPoint', 'AzureWorkloadRecoveryPoint': 'AzureWorkloadRecoveryPoint', 'GenericRecoveryPoint': 'GenericRecoveryPoint', 'IaasVMRecoveryPoint': 'IaasVMRecoveryPoint'} + "object_type": { + "AzureFileShareRecoveryPoint": "AzureFileShareRecoveryPoint", + "AzureWorkloadRecoveryPoint": "AzureWorkloadRecoveryPoint", + "GenericRecoveryPoint": "GenericRecoveryPoint", + "IaasVMRecoveryPoint": "IaasVMRecoveryPoint", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(RecoveryPoint, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -659,8 +687,8 @@ class AzureFileShareRecoveryPoint(RecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_type: Type of the backup copy. Specifies whether it is a crash consistent backup or app consistent. @@ -674,67 +702,63 @@ class AzureFileShareRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_type': {'readonly': True}, - 'recovery_point_time': {'readonly': True}, - 'file_share_snapshot_uri': {'readonly': True}, - 'recovery_point_size_in_gb': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_type": {"readonly": True}, + "recovery_point_time": {"readonly": True}, + "file_share_snapshot_uri": {"readonly": True}, + "recovery_point_size_in_gb": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'file_share_snapshot_uri': {'key': 'fileShareSnapshotUri', 'type': 'str'}, - 'recovery_point_size_in_gb': {'key': 'recoveryPointSizeInGB', 'type': 'int'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "file_share_snapshot_uri": {"key": "fileShareSnapshotUri", "type": "str"}, + "recovery_point_size_in_gb": {"key": "recoveryPointSizeInGB", "type": "int"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureFileShareRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'AzureFileShareRecoveryPoint' # type: str + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.object_type = "AzureFileShareRecoveryPoint" # type: str self.recovery_point_type = None self.recovery_point_time = None self.file_share_snapshot_uri = None self.recovery_point_size_in_gb = None -class RestoreRequest(msrest.serialization.Model): +class RestoreRequest(_serialization.Model): """Base class for restore request. Workload-specific restore requests are derived from this class. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileShareRestoreRequest, AzureWorkloadRestoreRequest, IaasVMRestoreRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureFileShareRestoreRequest, AzureWorkloadRestoreRequest, IaasVMRestoreRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureFileShareRestoreRequest': 'AzureFileShareRestoreRequest', 'AzureWorkloadRestoreRequest': 'AzureWorkloadRestoreRequest', 'IaasVMRestoreRequest': 'IaasVMRestoreRequest'} + "object_type": { + "AzureFileShareRestoreRequest": "AzureFileShareRestoreRequest", + "AzureWorkloadRestoreRequest": "AzureWorkloadRestoreRequest", + "IaasVMRestoreRequest": "IaasVMRestoreRequest", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(RestoreRequest, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -743,21 +767,21 @@ class AzureFileShareRestoreRequest(RestoreRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Source storage account ARM Id. :vartype source_resource_id: str - :ivar copy_options: Options to resolve copy conflicts. Possible values include: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + :ivar copy_options: Options to resolve copy conflicts. Known values are: "Invalid", + "CreateCopy", "Skip", "Overwrite", and "FailOnConflict". :vartype copy_options: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CopyOptions - :ivar restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Possible - values include: "Invalid", "FullShareRestore", "ItemLevelRestore". + :ivar restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Known values + are: "Invalid", "FullShareRestore", and "ItemLevelRestore". :vartype restore_request_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestoreRequestType :ivar restore_file_specs: List of Source Files/Folders(which need to recover) and @@ -770,43 +794,43 @@ class AzureFileShareRestoreRequest(RestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'copy_options': {'key': 'copyOptions', 'type': 'str'}, - 'restore_request_type': {'key': 'restoreRequestType', 'type': 'str'}, - 'restore_file_specs': {'key': 'restoreFileSpecs', 'type': '[RestoreFileSpecs]'}, - 'target_details': {'key': 'targetDetails', 'type': 'TargetAFSRestoreInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "copy_options": {"key": "copyOptions", "type": "str"}, + "restore_request_type": {"key": "restoreRequestType", "type": "str"}, + "restore_file_specs": {"key": "restoreFileSpecs", "type": "[RestoreFileSpecs]"}, + "target_details": {"key": "targetDetails", "type": "TargetAFSRestoreInfo"}, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, - copy_options: Optional[Union[str, "CopyOptions"]] = None, - restore_request_type: Optional[Union[str, "RestoreRequestType"]] = None, - restore_file_specs: Optional[List["RestoreFileSpecs"]] = None, - target_details: Optional["TargetAFSRestoreInfo"] = None, + copy_options: Optional[Union[str, "_models.CopyOptions"]] = None, + restore_request_type: Optional[Union[str, "_models.RestoreRequestType"]] = None, + restore_file_specs: Optional[List["_models.RestoreFileSpecs"]] = None, + target_details: Optional["_models.TargetAFSRestoreInfo"] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Source storage account ARM Id. :paramtype source_resource_id: str - :keyword copy_options: Options to resolve copy conflicts. Possible values include: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + :keyword copy_options: Options to resolve copy conflicts. Known values are: "Invalid", + "CreateCopy", "Skip", "Overwrite", and "FailOnConflict". :paramtype copy_options: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CopyOptions - :keyword restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Possible - values include: "Invalid", "FullShareRestore", "ItemLevelRestore". + :keyword restore_request_type: Restore Type (FullShareRestore or ItemLevelRestore). Known + values are: "Invalid", "FullShareRestore", and "ItemLevelRestore". :paramtype restore_request_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestoreRequestType :keyword restore_file_specs: List of Source Files/Folders(which need to recover) and @@ -817,8 +841,8 @@ def __init__( :paramtype target_details: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetAFSRestoreInfo """ - super(AzureFileShareRestoreRequest, self).__init__(**kwargs) - self.object_type = 'AzureFileShareRestoreRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureFileShareRestoreRequest" # type: str self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.copy_options = copy_options @@ -827,24 +851,24 @@ def __init__( self.target_details = target_details -class AzureIaaSVMProtectedItem(ProtectedItem): +class AzureIaaSVMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific backup item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSClassicComputeVMProtectedItem, AzureIaaSComputeVMProtectedItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSClassicComputeVMProtectedItem, AzureIaaSComputeVMProtectedItem All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -860,7 +884,7 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -885,12 +909,12 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :vartype virtual_machine_id: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :ivar health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -914,54 +938,57 @@ class AzureIaaSVMProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'health_details': {'key': 'healthDetails', 'type': '[AzureIaaSVMHealthDetails]'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMProtectedItemExtendedInfo'}, - 'extended_properties': {'key': 'extendedProperties', 'type': 'ExtendedProperties'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "health_details": {"key": "healthDetails", "type": "[AzureIaaSVMHealthDetails]"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMProtectedItemExtendedInfo"}, + "extended_properties": {"key": "extendedProperties", "type": "ExtendedProperties"}, } _subtype_map = { - 'protected_item_type': {'Microsoft.ClassicCompute/virtualMachines': 'AzureIaaSClassicComputeVMProtectedItem', 'Microsoft.Compute/virtualMachines': 'AzureIaaSComputeVMProtectedItem'} + "protected_item_type": { + "Microsoft.ClassicCompute/virtualMachines": "AzureIaaSClassicComputeVMProtectedItem", + "Microsoft.Compute/virtualMachines": "AzureIaaSComputeVMProtectedItem", + } } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -971,27 +998,27 @@ def __init__( friendly_name: Optional[str] = None, virtual_machine_id: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, - health_details: Optional[List["AzureIaaSVMHealthDetails"]] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_status: Optional[Union[str, "_models.HealthStatus"]] = None, + health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, last_backup_status: Optional[str] = None, last_backup_time: Optional[datetime.datetime] = None, protected_item_data_id: Optional[str] = None, - extended_info: Optional["AzureIaaSVMProtectedItemExtendedInfo"] = None, - extended_properties: Optional["ExtendedProperties"] = None, + extended_info: Optional["_models.AzureIaaSVMProtectedItemExtendedInfo"] = None, + extended_properties: Optional["_models.ExtendedProperties"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -1006,7 +1033,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -1033,13 +1060,12 @@ def __init__( :paramtype virtual_machine_id: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :keyword health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :keyword health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :keyword health_details: Health details on this backup item. @@ -1061,8 +1087,24 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ExtendedProperties """ - super(AzureIaaSVMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'AzureIaaSVMProtectedItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "AzureIaaSVMProtectedItem" # type: str self.friendly_name = friendly_name self.virtual_machine_id = virtual_machine_id self.protection_status = protection_status @@ -1077,21 +1119,21 @@ def __init__( self.extended_properties = extended_properties -class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): +class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific backup item representing the Classic Compute VM. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -1107,7 +1149,7 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -1132,12 +1174,12 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :vartype virtual_machine_id: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :ivar health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -1161,50 +1203,50 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'health_details': {'key': 'healthDetails', 'type': '[AzureIaaSVMHealthDetails]'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMProtectedItemExtendedInfo'}, - 'extended_properties': {'key': 'extendedProperties', 'type': 'ExtendedProperties'}, - } - - def __init__( + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "health_details": {"key": "healthDetails", "type": "[AzureIaaSVMHealthDetails]"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMProtectedItemExtendedInfo"}, + "extended_properties": {"key": "extendedProperties", "type": "ExtendedProperties"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -1214,27 +1256,27 @@ def __init__( friendly_name: Optional[str] = None, virtual_machine_id: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, - health_details: Optional[List["AzureIaaSVMHealthDetails"]] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_status: Optional[Union[str, "_models.HealthStatus"]] = None, + health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, last_backup_status: Optional[str] = None, last_backup_time: Optional[datetime.datetime] = None, protected_item_data_id: Optional[str] = None, - extended_info: Optional["AzureIaaSVMProtectedItemExtendedInfo"] = None, - extended_properties: Optional["ExtendedProperties"] = None, + extended_info: Optional["_models.AzureIaaSVMProtectedItemExtendedInfo"] = None, + extended_properties: Optional["_models.ExtendedProperties"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -1249,7 +1291,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -1276,13 +1318,12 @@ def __init__( :paramtype virtual_machine_id: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :keyword health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :keyword health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :keyword health_details: Health details on this backup item. @@ -1304,25 +1345,53 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ExtendedProperties """ - super(AzureIaaSClassicComputeVMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, friendly_name=friendly_name, virtual_machine_id=virtual_machine_id, protection_status=protection_status, protection_state=protection_state, health_status=health_status, health_details=health_details, kpis_healths=kpis_healths, last_backup_status=last_backup_status, last_backup_time=last_backup_time, protected_item_data_id=protected_item_data_id, extended_info=extended_info, extended_properties=extended_properties, **kwargs) - self.protected_item_type = 'Microsoft.ClassicCompute/virtualMachines' # type: str - - -class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + friendly_name=friendly_name, + virtual_machine_id=virtual_machine_id, + protection_status=protection_status, + protection_state=protection_state, + health_status=health_status, + health_details=health_details, + kpis_healths=kpis_healths, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + protected_item_data_id=protected_item_data_id, + extended_info=extended_info, + extended_properties=extended_properties, + **kwargs + ) + self.protected_item_type = "Microsoft.ClassicCompute/virtualMachines" # type: str + + +class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific backup item representing the Azure Resource Manager VM. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -1338,7 +1407,7 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -1363,12 +1432,12 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :vartype virtual_machine_id: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :ivar health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -1392,50 +1461,50 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'virtual_machine_id': {'key': 'virtualMachineId', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'health_status': {'key': 'healthStatus', 'type': 'str'}, - 'health_details': {'key': 'healthDetails', 'type': '[AzureIaaSVMHealthDetails]'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMProtectedItemExtendedInfo'}, - 'extended_properties': {'key': 'extendedProperties', 'type': 'ExtendedProperties'}, - } - - def __init__( + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "virtual_machine_id": {"key": "virtualMachineId", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "health_status": {"key": "healthStatus", "type": "str"}, + "health_details": {"key": "healthDetails", "type": "[AzureIaaSVMHealthDetails]"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMProtectedItemExtendedInfo"}, + "extended_properties": {"key": "extendedProperties", "type": "ExtendedProperties"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -1445,27 +1514,27 @@ def __init__( friendly_name: Optional[str] = None, virtual_machine_id: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - health_status: Optional[Union[str, "HealthStatus"]] = None, - health_details: Optional[List["AzureIaaSVMHealthDetails"]] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + health_status: Optional[Union[str, "_models.HealthStatus"]] = None, + health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, last_backup_status: Optional[str] = None, last_backup_time: Optional[datetime.datetime] = None, protected_item_data_id: Optional[str] = None, - extended_info: Optional["AzureIaaSVMProtectedItemExtendedInfo"] = None, - extended_properties: Optional["ExtendedProperties"] = None, + extended_info: Optional["_models.AzureIaaSVMProtectedItemExtendedInfo"] = None, + extended_properties: Optional["_models.ExtendedProperties"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -1480,7 +1549,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -1507,13 +1576,12 @@ def __init__( :paramtype virtual_machine_id: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState - :keyword health_status: Health status of protected item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :keyword health_status: Health status of protected item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :keyword health_details: Health details on this backup item. @@ -1535,11 +1603,39 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ExtendedProperties """ - super(AzureIaaSComputeVMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, friendly_name=friendly_name, virtual_machine_id=virtual_machine_id, protection_status=protection_status, protection_state=protection_state, health_status=health_status, health_details=health_details, kpis_healths=kpis_healths, last_backup_status=last_backup_status, last_backup_time=last_backup_time, protected_item_data_id=protected_item_data_id, extended_info=extended_info, extended_properties=extended_properties, **kwargs) - self.protected_item_type = 'Microsoft.Compute/virtualMachines' # type: str - - -class AzureIaaSVMErrorInfo(msrest.serialization.Model): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + friendly_name=friendly_name, + virtual_machine_id=virtual_machine_id, + protection_status=protection_status, + protection_state=protection_state, + health_status=health_status, + health_details=health_details, + kpis_healths=kpis_healths, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + protected_item_data_id=protected_item_data_id, + extended_info=extended_info, + extended_properties=extended_properties, + **kwargs + ) + self.protected_item_type = "Microsoft.Compute/virtualMachines" # type: str + + +class AzureIaaSVMErrorInfo(_serialization.Model): """Azure IaaS VM workload-specific error information. Variables are only populated by the server, and will be ignored when sending a request. @@ -1555,33 +1651,29 @@ class AzureIaaSVMErrorInfo(msrest.serialization.Model): """ _validation = { - 'error_code': {'readonly': True}, - 'error_title': {'readonly': True}, - 'error_string': {'readonly': True}, - 'recommendations': {'readonly': True}, + "error_code": {"readonly": True}, + "error_title": {"readonly": True}, + "error_string": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_title': {'key': 'errorTitle', 'type': 'str'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_title": {"key": "errorTitle", "type": "str"}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureIaaSVMErrorInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error_code = None self.error_title = None self.error_string = None self.recommendations = None -class ResourceHealthDetails(msrest.serialization.Model): +class ResourceHealthDetails(_serialization.Model): """Health Details for backup items. Variables are only populated by the server, and will be ignored when sending a request. @@ -1597,26 +1689,22 @@ class ResourceHealthDetails(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'title': {'readonly': True}, - 'message': {'readonly': True}, - 'recommendations': {'readonly': True}, + "code": {"readonly": True}, + "title": {"readonly": True}, + "message": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'int'}, - 'title': {'key': 'title', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "int"}, + "title": {"key": "title", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ResourceHealthDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.title = None self.message = None @@ -1639,41 +1727,37 @@ class AzureIaaSVMHealthDetails(ResourceHealthDetails): """ _validation = { - 'code': {'readonly': True}, - 'title': {'readonly': True}, - 'message': {'readonly': True}, - 'recommendations': {'readonly': True}, + "code": {"readonly": True}, + "title": {"readonly": True}, + "message": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'int'}, - 'title': {'key': 'title', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "int"}, + "title": {"key": "title", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureIaaSVMHealthDetails, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) -class Job(msrest.serialization.Model): +class Job(_serialization.Model): """Defines workload agnostic properties for a job. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureIaaSVMJob, AzureStorageJob, AzureWorkloadJob, DpmJob, MabJob. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureIaaSVMJob, AzureStorageJob, AzureWorkloadJob, DpmJob, MabJob All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :ivar operation: The operation name. @@ -1686,35 +1770,41 @@ class Job(msrest.serialization.Model): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, } _subtype_map = { - 'job_type': {'AzureIaaSVMJob': 'AzureIaaSVMJob', 'AzureStorageJob': 'AzureStorageJob', 'AzureWorkloadJob': 'AzureWorkloadJob', 'DpmJob': 'DpmJob', 'MabJob': 'MabJob'} + "job_type": { + "AzureIaaSVMJob": "AzureIaaSVMJob", + "AzureStorageJob": "AzureStorageJob", + "AzureWorkloadJob": "AzureWorkloadJob", + "DpmJob": "DpmJob", + "MabJob": "MabJob", + } } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, @@ -1726,9 +1816,9 @@ def __init__( :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -1742,7 +1832,7 @@ def __init__( :keyword activity_id: ActivityId of job. :paramtype activity_id: str """ - super(Job, self).__init__(**kwargs) + super().__init__(**kwargs) self.entity_friendly_name = entity_friendly_name self.backup_management_type = backup_management_type self.operation = operation @@ -1753,16 +1843,16 @@ def __init__( self.job_type = None # type: Optional[str] -class AzureIaaSVMJob(Job): +class AzureIaaSVMJob(Job): # pylint: disable=too-many-instance-attributes """Azure IaaS VM workload-specific job object. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :ivar operation: The operation name. @@ -1775,8 +1865,8 @@ class AzureIaaSVMJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed during the execution of this job. :vartype duration: ~datetime.timedelta @@ -1795,49 +1885,49 @@ class AzureIaaSVMJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureIaaSVMErrorInfo]'}, - 'virtual_machine_version': {'key': 'virtualMachineVersion', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureIaaSVMJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[AzureIaaSVMErrorInfo]"}, + "virtual_machine_version": {"key": "virtualMachineVersion", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureIaaSVMJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["AzureIaaSVMErrorInfo"]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.AzureIaaSVMErrorInfo"]] = None, virtual_machine_version: Optional[str] = None, - extended_info: Optional["AzureIaaSVMJobExtendedInfo"] = None, + extended_info: Optional["_models.AzureIaaSVMJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -1865,8 +1955,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AzureIaaSVMJobExtendedInfo """ - super(AzureIaaSVMJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureIaaSVMJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureIaaSVMJob" # type: str self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -1874,7 +1973,7 @@ def __init__( self.extended_info = extended_info -class AzureIaaSVMJobExtendedInfo(msrest.serialization.Model): +class AzureIaaSVMJobExtendedInfo(_serialization.Model): """Azure IaaS VM workload-specific additional information for job. :ivar tasks_list: List of tasks associated with this job. @@ -1894,18 +1993,18 @@ class AzureIaaSVMJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[AzureIaaSVMJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'internal_property_bag': {'key': 'internalPropertyBag', 'type': '{str}'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'float'}, - 'estimated_remaining_duration': {'key': 'estimatedRemainingDuration', 'type': 'str'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[AzureIaaSVMJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "internal_property_bag": {"key": "internalPropertyBag", "type": "{str}"}, + "progress_percentage": {"key": "progressPercentage", "type": "float"}, + "estimated_remaining_duration": {"key": "estimatedRemainingDuration", "type": "str"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["AzureIaaSVMJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.AzureIaaSVMJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, internal_property_bag: Optional[Dict[str, str]] = None, progress_percentage: Optional[float] = None, @@ -1929,7 +2028,7 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(AzureIaaSVMJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.internal_property_bag = internal_property_bag @@ -1938,7 +2037,7 @@ def __init__( self.dynamic_error_message = dynamic_error_message -class AzureIaaSVMJobTaskDetails(msrest.serialization.Model): +class AzureIaaSVMJobTaskDetails(_serialization.Model): """Azure IaaS VM workload-specific job task details. :ivar task_id: The task display name. @@ -1961,14 +2060,14 @@ class AzureIaaSVMJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'instance_id': {'key': 'instanceId', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'status': {'key': 'status', 'type': 'str'}, - 'progress_percentage': {'key': 'progressPercentage', 'type': 'float'}, - 'task_execution_details': {'key': 'taskExecutionDetails', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "instance_id": {"key": "instanceId", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "status": {"key": "status", "type": "str"}, + "progress_percentage": {"key": "progressPercentage", "type": "float"}, + "task_execution_details": {"key": "taskExecutionDetails", "type": "str"}, } def __init__( @@ -2003,7 +2102,7 @@ def __init__( eg: number of bytes transferred etc. :paramtype task_execution_details: str """ - super(AzureIaaSVMJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.start_time = start_time self.end_time = end_time @@ -2014,7 +2113,7 @@ def __init__( self.task_execution_details = task_execution_details -class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureIaaSVMProtectedItemExtendedInfo(_serialization.Model): """Additional information on Azure IaaS VM specific backup item. :ivar oldest_recovery_point: The oldest backup copy available for this backup item. @@ -2027,9 +2126,9 @@ class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_inconsistent': {'key': 'policyInconsistent', 'type': 'bool'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_inconsistent": {"key": "policyInconsistent", "type": "bool"}, } def __init__( @@ -2049,27 +2148,27 @@ def __init__( inconsistent. :paramtype policy_inconsistent: bool """ - super(AzureIaaSVMProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count self.policy_inconsistent = policy_inconsistent -class AzureSqlProtectedItem(ProtectedItem): +class AzureSqlProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Azure SQL workload-specific backup item. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2085,7 +2184,7 @@ class AzureSqlProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -2106,8 +2205,8 @@ class AzureSqlProtectedItem(ProtectedItem): :ivar protected_item_data_id: Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services. :vartype protected_item_data_id: str - :ivar protection_state: Backup state of the backed up item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of the backed up item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemState :ivar extended_info: Additional information for this backup item. @@ -2116,41 +2215,41 @@ class AzureSqlProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'protected_item_data_id': {'key': 'protectedItemDataId', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureSqlProtectedItemExtendedInfo'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureSqlProtectedItemExtendedInfo"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -2158,20 +2257,20 @@ def __init__( is_rehydrate: Optional[bool] = None, resource_guard_operation_requests: Optional[List[str]] = None, protected_item_data_id: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectedItemState"]] = None, - extended_info: Optional["AzureSqlProtectedItemExtendedInfo"] = None, + protection_state: Optional[Union[str, "_models.ProtectedItemState"]] = None, + extended_info: Optional["_models.AzureSqlProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -2186,7 +2285,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -2209,23 +2308,38 @@ def __init__( :keyword protected_item_data_id: Internal ID of a backup item. Used by Azure SQL Backup engine to contact Recovery Services. :paramtype protected_item_data_id: str - :keyword protection_state: Backup state of the backed up item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of the backed up item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemState :keyword extended_info: Additional information for this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AzureSqlProtectedItemExtendedInfo """ - super(AzureSqlProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'Microsoft.Sql/servers/databases' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "Microsoft.Sql/servers/databases" # type: str self.protected_item_data_id = protected_item_data_id self.protection_state = protection_state self.extended_info = extended_info -class AzureSqlProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureSqlProtectedItemExtendedInfo(_serialization.Model): """Additional information on Azure Sql specific protected item. :ivar oldest_recovery_point: The oldest backup copy available for this item in the service. @@ -2237,9 +2351,9 @@ class AzureSqlProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_state": {"key": "policyState", "type": "str"}, } def __init__( @@ -2259,13 +2373,13 @@ def __init__( :keyword policy_state: State of the backup policy associated with this backup item. :paramtype policy_state: str """ - super(AzureSqlProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count self.policy_state = policy_state -class AzureStorageErrorInfo(msrest.serialization.Model): +class AzureStorageErrorInfo(_serialization.Model): """Azure storage specific error information. :ivar error_code: Error code. @@ -2277,9 +2391,9 @@ class AzureStorageErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } def __init__( @@ -2298,22 +2412,22 @@ def __init__( :keyword recommendations: List of localized recommendations for above error code. :paramtype recommendations: list[str] """ - super(AzureStorageErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_code = error_code self.error_string = error_string self.recommendations = recommendations -class AzureStorageJob(Job): +class AzureStorageJob(Job): # pylint: disable=too-many-instance-attributes """Azure storage specific job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :ivar operation: The operation name. @@ -2326,8 +2440,8 @@ class AzureStorageJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed during the execution of this job. :vartype duration: ~datetime.timedelta @@ -2348,51 +2462,51 @@ class AzureStorageJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureStorageErrorInfo]'}, - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - 'storage_account_version': {'key': 'storageAccountVersion', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureStorageJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[AzureStorageErrorInfo]"}, + "storage_account_name": {"key": "storageAccountName", "type": "str"}, + "storage_account_version": {"key": "storageAccountVersion", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureStorageJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["AzureStorageErrorInfo"]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.AzureStorageErrorInfo"]] = None, storage_account_name: Optional[str] = None, storage_account_version: Optional[str] = None, - extended_info: Optional["AzureStorageJobExtendedInfo"] = None, + extended_info: Optional["_models.AzureStorageJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -2422,8 +2536,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AzureStorageJobExtendedInfo """ - super(AzureStorageJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureStorageJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureStorageJob" # type: str self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -2432,7 +2555,7 @@ def __init__( self.extended_info = extended_info -class AzureStorageJobExtendedInfo(msrest.serialization.Model): +class AzureStorageJobExtendedInfo(_serialization.Model): """Azure Storage workload-specific additional information for job. :ivar tasks_list: List of tasks for this job. @@ -2445,15 +2568,15 @@ class AzureStorageJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[AzureStorageJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[AzureStorageJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["AzureStorageJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.AzureStorageJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -2467,13 +2590,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(AzureStorageJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class AzureStorageJobTaskDetails(msrest.serialization.Model): +class AzureStorageJobTaskDetails(_serialization.Model): """Azure storage workload specific job task details. :ivar task_id: The task display name. @@ -2483,46 +2606,41 @@ class AzureStorageJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "status": {"key": "status", "type": "str"}, } - def __init__( - self, - *, - task_id: Optional[str] = None, - status: Optional[str] = None, - **kwargs - ): + def __init__(self, *, task_id: Optional[str] = None, status: Optional[str] = None, **kwargs): """ :keyword task_id: The task display name. :paramtype task_id: str :keyword status: The status. :paramtype status: str """ - super(AzureStorageJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.status = status -class AzureVmWorkloadProtectedItem(ProtectedItem): +class AzureVmWorkloadProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureVmWorkloadSAPAseDatabaseProtectedItem, AzureVmWorkloadSAPHanaDatabaseProtectedItem, AzureVmWorkloadSQLDatabaseProtectedItem. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureVmWorkloadSAPAseDatabaseProtectedItem, AzureVmWorkloadSAPHanaDatabaseProtectedItem, + AzureVmWorkloadSQLDatabaseProtectedItem All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2538,7 +2656,7 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -2567,12 +2685,12 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -2583,7 +2701,7 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus @@ -2596,55 +2714,59 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, } _subtype_map = { - 'protected_item_type': {'AzureVmWorkloadSAPAseDatabase': 'AzureVmWorkloadSAPAseDatabaseProtectedItem', 'AzureVmWorkloadSAPHanaDatabase': 'AzureVmWorkloadSAPHanaDatabaseProtectedItem', 'AzureVmWorkloadSQLDatabase': 'AzureVmWorkloadSQLDatabaseProtectedItem'} + "protected_item_type": { + "AzureVmWorkloadSAPAseDatabase": "AzureVmWorkloadSAPAseDatabaseProtectedItem", + "AzureVmWorkloadSAPHanaDatabase": "AzureVmWorkloadSAPHanaDatabaseProtectedItem", + "AzureVmWorkloadSQLDatabase": "AzureVmWorkloadSQLDatabaseProtectedItem", + } } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -2656,26 +2778,26 @@ def __init__( parent_name: Optional[str] = None, parent_type: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -2690,7 +2812,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -2721,13 +2843,12 @@ def __init__( :paramtype parent_type: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -2738,8 +2859,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -2749,8 +2870,24 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'AzureVmWorkloadProtectedItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadProtectedItem" # type: str self.friendly_name = friendly_name self.server_name = server_name self.parent_name = parent_name @@ -2766,7 +2903,7 @@ def __init__( self.kpis_healths = kpis_healths -class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): +class AzureVmWorkloadProtectedItemExtendedInfo(_serialization.Model): """Additional information on Azure Workload for SQL specific backup item. :ivar oldest_recovery_point: The oldest backup copy available for this backup item. @@ -2779,9 +2916,9 @@ class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "policy_state": {"key": "policyState", "type": "str"}, } def __init__( @@ -2801,27 +2938,29 @@ def __init__( item. :paramtype policy_state: str """ - super(AzureVmWorkloadProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count self.policy_state = policy_state -class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): +class AzureVmWorkloadSAPAseDatabaseProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item representing SAP ASE Database. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2837,7 +2976,7 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -2866,12 +3005,12 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -2882,7 +3021,7 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus @@ -2895,51 +3034,51 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - } - - def __init__( + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -2951,26 +3090,26 @@ def __init__( parent_name: Optional[str] = None, parent_type: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -2985,7 +3124,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -3016,13 +3155,12 @@ def __init__( :paramtype parent_type: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -3033,8 +3171,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -3044,25 +3182,56 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPAseDatabaseProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, friendly_name=friendly_name, server_name=server_name, parent_name=parent_name, parent_type=parent_type, protection_status=protection_status, protection_state=protection_state, last_backup_status=last_backup_status, last_backup_time=last_backup_time, last_backup_error_detail=last_backup_error_detail, protected_item_data_source_id=protected_item_data_source_id, protected_item_health_status=protected_item_health_status, extended_info=extended_info, kpis_healths=kpis_healths, **kwargs) - self.protected_item_type = 'AzureVmWorkloadSAPAseDatabase' # type: str - - -class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + friendly_name=friendly_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_status=protection_status, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSAPAseDatabase" # type: str + + +class AzureVmWorkloadSAPHanaDatabaseProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item representing SAP HANA Database. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -3078,7 +3247,7 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -3107,12 +3276,12 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -3123,7 +3292,7 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus @@ -3136,51 +3305,51 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - } - - def __init__( + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -3192,26 +3361,26 @@ def __init__( parent_name: Optional[str] = None, parent_type: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -3226,7 +3395,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -3257,13 +3426,12 @@ def __init__( :paramtype parent_type: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -3274,8 +3442,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -3285,25 +3453,56 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPHanaDatabaseProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, friendly_name=friendly_name, server_name=server_name, parent_name=parent_name, parent_type=parent_type, protection_status=protection_status, protection_state=protection_state, last_backup_status=last_backup_status, last_backup_time=last_backup_time, last_backup_error_detail=last_backup_error_detail, protected_item_data_source_id=protected_item_data_source_id, protected_item_health_status=protected_item_health_status, extended_info=extended_info, kpis_healths=kpis_healths, **kwargs) - self.protected_item_type = 'AzureVmWorkloadSAPHanaDatabase' # type: str - - -class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + friendly_name=friendly_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_status=protection_status, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSAPHanaDatabase" # type: str + + +class AzureVmWorkloadSQLDatabaseProtectedItem( + AzureVmWorkloadProtectedItem +): # pylint: disable=too-many-instance-attributes """Azure VM workload-specific protected item representing SQL Database. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -3319,7 +3518,7 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -3348,12 +3547,12 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype parent_type: str :ivar protection_status: Backup status of this backup item. :vartype protection_status: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :ivar last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :vartype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :ivar last_backup_time: Timestamp of the last backup operation on this backup item. @@ -3364,7 +3563,7 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :ivar protected_item_data_source_id: Data ID of the protected item. :vartype protected_item_data_source_id: str :ivar protected_item_health_status: Health status of the backup item, evaluated based on last - heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", "NotReachable", + heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", and "IRPending". :vartype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus @@ -3377,51 +3576,51 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'server_name': {'key': 'serverName', 'type': 'str'}, - 'parent_name': {'key': 'parentName', 'type': 'str'}, - 'parent_type': {'key': 'parentType', 'type': 'str'}, - 'protection_status': {'key': 'protectionStatus', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'last_backup_error_detail': {'key': 'lastBackupErrorDetail', 'type': 'ErrorDetail'}, - 'protected_item_data_source_id': {'key': 'protectedItemDataSourceId', 'type': 'str'}, - 'protected_item_health_status': {'key': 'protectedItemHealthStatus', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureVmWorkloadProtectedItemExtendedInfo'}, - 'kpis_healths': {'key': 'kpisHealths', 'type': '{KPIResourceHealthDetails}'}, - } - - def __init__( + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "server_name": {"key": "serverName", "type": "str"}, + "parent_name": {"key": "parentName", "type": "str"}, + "parent_type": {"key": "parentType", "type": "str"}, + "protection_status": {"key": "protectionStatus", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "last_backup_error_detail": {"key": "lastBackupErrorDetail", "type": "ErrorDetail"}, + "protected_item_data_source_id": {"key": "protectedItemDataSourceId", "type": "str"}, + "protected_item_health_status": {"key": "protectedItemHealthStatus", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureVmWorkloadProtectedItemExtendedInfo"}, + "kpis_healths": {"key": "kpisHealths", "type": "{KPIResourceHealthDetails}"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -3433,26 +3632,26 @@ def __init__( parent_name: Optional[str] = None, parent_type: Optional[str] = None, protection_status: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, - last_backup_status: Optional[Union[str, "LastBackupStatus"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, + last_backup_status: Optional[Union[str, "_models.LastBackupStatus"]] = None, last_backup_time: Optional[datetime.datetime] = None, - last_backup_error_detail: Optional["ErrorDetail"] = None, + last_backup_error_detail: Optional["_models.ErrorDetail"] = None, protected_item_data_source_id: Optional[str] = None, - protected_item_health_status: Optional[Union[str, "ProtectedItemHealthStatus"]] = None, - extended_info: Optional["AzureVmWorkloadProtectedItemExtendedInfo"] = None, - kpis_healths: Optional[Dict[str, "KPIResourceHealthDetails"]] = None, + protected_item_health_status: Optional[Union[str, "_models.ProtectedItemHealthStatus"]] = None, + extended_info: Optional["_models.AzureVmWorkloadProtectedItemExtendedInfo"] = None, + kpis_healths: Optional[Dict[str, "_models.KPIResourceHealthDetails"]] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -3467,7 +3666,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -3498,13 +3697,12 @@ def __init__( :paramtype parent_type: str :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :keyword last_backup_status: Last backup operation status. Possible values: Healthy, Unhealthy. - Possible values include: "Invalid", "Healthy", "Unhealthy", "IRPending". + Known values are: "Invalid", "Healthy", "Unhealthy", and "IRPending". :paramtype last_backup_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.LastBackupStatus :keyword last_backup_time: Timestamp of the last backup operation on this backup item. @@ -3515,8 +3713,8 @@ def __init__( :keyword protected_item_data_source_id: Data ID of the protected item. :paramtype protected_item_data_source_id: str :keyword protected_item_health_status: Health status of the backup item, evaluated based on - last heartbeat received. Possible values include: "Invalid", "Healthy", "Unhealthy", - "NotReachable", "IRPending". + last heartbeat received. Known values are: "Invalid", "Healthy", "Unhealthy", "NotReachable", + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -3526,11 +3724,40 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSQLDatabaseProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, friendly_name=friendly_name, server_name=server_name, parent_name=parent_name, parent_type=parent_type, protection_status=protection_status, protection_state=protection_state, last_backup_status=last_backup_status, last_backup_time=last_backup_time, last_backup_error_detail=last_backup_error_detail, protected_item_data_source_id=protected_item_data_source_id, protected_item_health_status=protected_item_health_status, extended_info=extended_info, kpis_healths=kpis_healths, **kwargs) - self.protected_item_type = 'AzureVmWorkloadSQLDatabase' # type: str - - -class AzureWorkloadErrorInfo(msrest.serialization.Model): + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + friendly_name=friendly_name, + server_name=server_name, + parent_name=parent_name, + parent_type=parent_type, + protection_status=protection_status, + protection_state=protection_state, + last_backup_status=last_backup_status, + last_backup_time=last_backup_time, + last_backup_error_detail=last_backup_error_detail, + protected_item_data_source_id=protected_item_data_source_id, + protected_item_health_status=protected_item_health_status, + extended_info=extended_info, + kpis_healths=kpis_healths, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadSQLDatabase" # type: str + + +class AzureWorkloadErrorInfo(_serialization.Model): """Azure storage specific error information. :ivar error_code: Error code. @@ -3546,11 +3773,11 @@ class AzureWorkloadErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'error_title': {'key': 'errorTitle', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, - 'additional_details': {'key': 'additionalDetails', 'type': 'str'}, + "error_code": {"key": "errorCode", "type": "int"}, + "error_string": {"key": "errorString", "type": "str"}, + "error_title": {"key": "errorTitle", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, + "additional_details": {"key": "additionalDetails", "type": "str"}, } def __init__( @@ -3575,7 +3802,7 @@ def __init__( :keyword additional_details: Additional details for above error code. :paramtype additional_details: str """ - super(AzureWorkloadErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_code = error_code self.error_string = error_string self.error_title = error_title @@ -3583,16 +3810,16 @@ def __init__( self.additional_details = additional_details -class AzureWorkloadJob(Job): +class AzureWorkloadJob(Job): # pylint: disable=too-many-instance-attributes """Azure storage specific job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :ivar operation: The operation name. @@ -3605,8 +3832,8 @@ class AzureWorkloadJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar workload_type: Workload type of the job. :vartype workload_type: str @@ -3624,30 +3851,30 @@ class AzureWorkloadJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[AzureWorkloadErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[AzureWorkloadErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, @@ -3655,18 +3882,18 @@ def __init__( activity_id: Optional[str] = None, workload_type: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["AzureWorkloadErrorInfo"]] = None, - extended_info: Optional["AzureWorkloadJobExtendedInfo"] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.AzureWorkloadErrorInfo"]] = None, + extended_info: Optional["_models.AzureWorkloadJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3693,8 +3920,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AzureWorkloadJobExtendedInfo """ - super(AzureWorkloadJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'AzureWorkloadJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "AzureWorkloadJob" # type: str self.workload_type = workload_type self.duration = duration self.actions_info = actions_info @@ -3702,7 +3938,7 @@ def __init__( self.extended_info = extended_info -class AzureWorkloadJobExtendedInfo(msrest.serialization.Model): +class AzureWorkloadJobExtendedInfo(_serialization.Model): """Azure VM workload-specific additional information for job. :ivar tasks_list: List of tasks for this job. @@ -3715,15 +3951,15 @@ class AzureWorkloadJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[AzureWorkloadJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[AzureWorkloadJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["AzureWorkloadJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.AzureWorkloadJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -3737,13 +3973,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(AzureWorkloadJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class AzureWorkloadJobTaskDetails(msrest.serialization.Model): +class AzureWorkloadJobTaskDetails(_serialization.Model): """Azure VM workload specific job task details. :ivar task_id: The task display name. @@ -3753,24 +3989,18 @@ class AzureWorkloadJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "status": {"key": "status", "type": "str"}, } - def __init__( - self, - *, - task_id: Optional[str] = None, - status: Optional[str] = None, - **kwargs - ): + def __init__(self, *, task_id: Optional[str] = None, status: Optional[str] = None, **kwargs): """ :keyword task_id: The task display name. :paramtype task_id: str :keyword status: The status. :paramtype status: str """ - super(AzureWorkloadJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.status = status @@ -3778,20 +4008,21 @@ def __init__( class AzureWorkloadRecoveryPoint(RecoveryPoint): """Workload specific recovery point, specifically encapsulates full/diff recovery point. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadPointInTimeRecoveryPoint, AzureWorkloadSAPHanaRecoveryPoint, AzureWorkloadSQLRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadPointInTimeRecoveryPoint, AzureWorkloadSAPHanaRecoveryPoint, + AzureWorkloadSQLRecoveryPoint 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 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. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + and "Incremental". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -3802,28 +4033,35 @@ class AzureWorkloadRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_time_in_utc': {'readonly': True}, - 'type': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_time_in_utc": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, } _subtype_map = { - 'object_type': {'AzureWorkloadPointInTimeRecoveryPoint': 'AzureWorkloadPointInTimeRecoveryPoint', 'AzureWorkloadSAPHanaRecoveryPoint': 'AzureWorkloadSAPHanaRecoveryPoint', 'AzureWorkloadSQLRecoveryPoint': 'AzureWorkloadSQLRecoveryPoint'} + "object_type": { + "AzureWorkloadPointInTimeRecoveryPoint": "AzureWorkloadPointInTimeRecoveryPoint", + "AzureWorkloadSAPHanaRecoveryPoint": "AzureWorkloadSAPHanaRecoveryPoint", + "AzureWorkloadSQLRecoveryPoint": "AzureWorkloadSQLRecoveryPoint", + } } def __init__( self, *, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, **kwargs ): """ @@ -3834,8 +4072,8 @@ def __init__( :paramtype recovery_point_move_readiness_info: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointMoveReadinessInfo] """ - super(AzureWorkloadRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'AzureWorkloadRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "AzureWorkloadRecoveryPoint" # type: str self.recovery_point_time_in_utc = None self.type = None self.recovery_point_tier_details = recovery_point_tier_details @@ -3845,20 +4083,20 @@ def __init__( class AzureWorkloadPointInTimeRecoveryPoint(AzureWorkloadRecoveryPoint): """Recovery point specific to PointInTime. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSAPHanaPointInTimeRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSAPHanaPointInTimeRecoveryPoint 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 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. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + and "Incremental". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -3872,30 +4110,33 @@ class AzureWorkloadPointInTimeRecoveryPoint(AzureWorkloadRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_time_in_utc': {'readonly': True}, - 'type': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_time_in_utc": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[PointInTimeRange]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "time_ranges": {"key": "timeRanges", "type": "[PointInTimeRange]"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSAPHanaPointInTimeRecoveryPoint': 'AzureWorkloadSAPHanaPointInTimeRecoveryPoint'} + "object_type": {"AzureWorkloadSAPHanaPointInTimeRecoveryPoint": "AzureWorkloadSAPHanaPointInTimeRecoveryPoint"} } def __init__( self, *, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - time_ranges: Optional[List["PointInTimeRange"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + time_ranges: Optional[List["_models.PointInTimeRange"]] = None, **kwargs ): """ @@ -3909,24 +4150,29 @@ def __init__( :paramtype time_ranges: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.PointInTimeRange] """ - super(AzureWorkloadPointInTimeRecoveryPoint, self).__init__(recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs) - self.object_type = 'AzureWorkloadPointInTimeRecoveryPoint' # type: str + super().__init__( + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + **kwargs + ) + self.object_type = "AzureWorkloadPointInTimeRecoveryPoint" # type: str self.time_ranges = time_ranges class AzureWorkloadRestoreRequest(RestoreRequest): """AzureWorkload-specific restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadPointInTimeRestoreRequest, AzureWorkloadSAPHanaRestoreRequest, AzureWorkloadSQLRestoreRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadPointInTimeRestoreRequest, AzureWorkloadSAPHanaRestoreRequest, + AzureWorkloadSQLRestoreRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -3937,7 +4183,7 @@ class AzureWorkloadRestoreRequest(RestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -3947,37 +4193,41 @@ class AzureWorkloadRestoreRequest(RestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureWorkloadPointInTimeRestoreRequest': 'AzureWorkloadPointInTimeRestoreRequest', 'AzureWorkloadSAPHanaRestoreRequest': 'AzureWorkloadSAPHanaRestoreRequest', 'AzureWorkloadSQLRestoreRequest': 'AzureWorkloadSQLRestoreRequest'} + "object_type": { + "AzureWorkloadPointInTimeRestoreRequest": "AzureWorkloadPointInTimeRestoreRequest", + "AzureWorkloadSAPHanaRestoreRequest": "AzureWorkloadSAPHanaRestoreRequest", + "AzureWorkloadSQLRestoreRequest": "AzureWorkloadSQLRestoreRequest", + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -3989,7 +4239,7 @@ def __init__( :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -3997,8 +4247,8 @@ def __init__( /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}. :paramtype target_virtual_machine_id: str """ - super(AzureWorkloadRestoreRequest, self).__init__(**kwargs) - self.object_type = 'AzureWorkloadRestoreRequest' # type: str + super().__init__(**kwargs) + self.object_type = "AzureWorkloadRestoreRequest" # type: str self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.property_bag = property_bag @@ -4012,11 +4262,11 @@ class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -4027,7 +4277,7 @@ class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4039,35 +4289,35 @@ class AzureWorkloadPointInTimeRestoreRequest(AzureWorkloadRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, point_in_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -4079,7 +4329,7 @@ def __init__( :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4089,8 +4339,16 @@ def __init__( :keyword point_in_time: PointInTime value. :paramtype point_in_time: ~datetime.datetime """ - super(AzureWorkloadPointInTimeRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadPointInTimeRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadPointInTimeRestoreRequest" # type: str self.point_in_time = point_in_time @@ -4101,13 +4359,13 @@ class AzureWorkloadSAPHanaPointInTimeRecoveryPoint(AzureWorkloadPointInTimeRecov All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + and "Incremental". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -4121,26 +4379,29 @@ class AzureWorkloadSAPHanaPointInTimeRecoveryPoint(AzureWorkloadPointInTimeRecov """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_time_in_utc': {'readonly': True}, - 'type': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_time_in_utc": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[PointInTimeRange]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "time_ranges": {"key": "timeRanges", "type": "[PointInTimeRange]"}, } def __init__( self, *, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - time_ranges: Optional[List["PointInTimeRange"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + time_ranges: Optional[List["_models.PointInTimeRange"]] = None, **kwargs ): """ @@ -4154,23 +4415,28 @@ def __init__( :paramtype time_ranges: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.PointInTimeRange] """ - super(AzureWorkloadSAPHanaPointInTimeRecoveryPoint, self).__init__(recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, time_ranges=time_ranges, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaPointInTimeRecoveryPoint' # type: str + super().__init__( + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + time_ranges=time_ranges, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" # type: str class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SAP Hana-specific restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSAPHanaPointInTimeRestoreRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSAPHanaPointInTimeRestoreRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -4181,7 +4447,7 @@ class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4191,37 +4457,39 @@ class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSAPHanaPointInTimeRestoreRequest': 'AzureWorkloadSAPHanaPointInTimeRestoreRequest'} + "object_type": { + "AzureWorkloadSAPHanaPointInTimeRestoreRequest": "AzureWorkloadSAPHanaPointInTimeRestoreRequest" + } } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -4233,7 +4501,7 @@ def __init__( :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4241,8 +4509,16 @@ def __init__( /subscriptions/{subId}/resourcegroups/{rg}/provider/Microsoft.Compute/virtualmachines/{vm}. :paramtype target_virtual_machine_id: str """ - super(AzureWorkloadSAPHanaRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaRestoreRequest" # type: str class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreRequest): @@ -4250,11 +4526,11 @@ class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreR All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -4265,7 +4541,7 @@ class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreR :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4277,35 +4553,35 @@ class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreR """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, point_in_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -4317,7 +4593,7 @@ def __init__( :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4327,8 +4603,16 @@ def __init__( :keyword point_in_time: PointInTime value. :paramtype point_in_time: ~datetime.datetime """ - super(AzureWorkloadSAPHanaPointInTimeRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaPointInTimeRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" # type: str self.point_in_time = point_in_time @@ -4339,13 +4623,13 @@ class AzureWorkloadSAPHanaRecoveryPoint(AzureWorkloadRecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + and "Incremental". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -4356,24 +4640,27 @@ class AzureWorkloadSAPHanaRecoveryPoint(AzureWorkloadRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_time_in_utc': {'readonly': True}, - 'type': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_time_in_utc": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, } def __init__( self, *, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, **kwargs ): """ @@ -4384,27 +4671,31 @@ def __init__( :paramtype recovery_point_move_readiness_info: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointMoveReadinessInfo] """ - super(AzureWorkloadSAPHanaRecoveryPoint, self).__init__(recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs) - self.object_type = 'AzureWorkloadSAPHanaRecoveryPoint' # type: str + super().__init__( + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + **kwargs + ) + self.object_type = "AzureWorkloadSAPHanaRecoveryPoint" # type: str class AzureWorkloadSQLRecoveryPoint(AzureWorkloadRecoveryPoint): """SQL specific recoverypoint, specifically encapsulates full/diff recoverypoint along with extended info. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSQLPointInTimeRecoveryPoint. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSQLPointInTimeRecoveryPoint 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 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. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + and "Incremental". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -4421,30 +4712,33 @@ class AzureWorkloadSQLRecoveryPoint(AzureWorkloadRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_time_in_utc': {'readonly': True}, - 'type': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_time_in_utc": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadSQLRecoveryPointExtendedInfo'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadSQLRecoveryPointExtendedInfo"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSQLPointInTimeRecoveryPoint': 'AzureWorkloadSQLPointInTimeRecoveryPoint'} + "object_type": {"AzureWorkloadSQLPointInTimeRecoveryPoint": "AzureWorkloadSQLPointInTimeRecoveryPoint"} } def __init__( self, *, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - extended_info: Optional["AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + extended_info: Optional["_models.AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, **kwargs ): """ @@ -4461,8 +4755,12 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AzureWorkloadSQLRecoveryPointExtendedInfo """ - super(AzureWorkloadSQLRecoveryPoint, self).__init__(recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs) - self.object_type = 'AzureWorkloadSQLRecoveryPoint' # type: str + super().__init__( + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + **kwargs + ) + self.object_type = "AzureWorkloadSQLRecoveryPoint" # type: str self.extended_info = extended_info @@ -4473,13 +4771,13 @@ class AzureWorkloadSQLPointInTimeRecoveryPoint(AzureWorkloadSQLRecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_time_in_utc: UTC time at which recovery point was created. :vartype recovery_point_time_in_utc: ~datetime.datetime - :ivar type: Type of restore point. Possible values include: "Invalid", "Full", "Log", - "Differential", "Incremental". + :ivar type: Type of restore point. Known values are: "Invalid", "Full", "Log", "Differential", + and "Incremental". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointType :ivar recovery_point_tier_details: Recovery point tier information. :vartype recovery_point_tier_details: @@ -4499,28 +4797,31 @@ class AzureWorkloadSQLPointInTimeRecoveryPoint(AzureWorkloadSQLRecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_time_in_utc': {'readonly': True}, - 'type': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_time_in_utc": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_time_in_utc': {'key': 'recoveryPointTimeInUTC', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'AzureWorkloadSQLRecoveryPointExtendedInfo'}, - 'time_ranges': {'key': 'timeRanges', 'type': '[PointInTimeRange]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_time_in_utc": {"key": "recoveryPointTimeInUTC", "type": "iso-8601"}, + "type": {"key": "type", "type": "str"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, + "extended_info": {"key": "extendedInfo", "type": "AzureWorkloadSQLRecoveryPointExtendedInfo"}, + "time_ranges": {"key": "timeRanges", "type": "[PointInTimeRange]"}, } def __init__( self, *, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, - extended_info: Optional["AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, - time_ranges: Optional[List["PointInTimeRange"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, + extended_info: Optional["_models.AzureWorkloadSQLRecoveryPointExtendedInfo"] = None, + time_ranges: Optional[List["_models.PointInTimeRange"]] = None, **kwargs ): """ @@ -4540,24 +4841,29 @@ def __init__( :paramtype time_ranges: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.PointInTimeRange] """ - super(AzureWorkloadSQLPointInTimeRecoveryPoint, self).__init__(recovery_point_tier_details=recovery_point_tier_details, recovery_point_move_readiness_info=recovery_point_move_readiness_info, extended_info=extended_info, **kwargs) - self.object_type = 'AzureWorkloadSQLPointInTimeRecoveryPoint' # type: str + super().__init__( + recovery_point_tier_details=recovery_point_tier_details, + recovery_point_move_readiness_info=recovery_point_move_readiness_info, + extended_info=extended_info, + **kwargs + ) + self.object_type = "AzureWorkloadSQLPointInTimeRecoveryPoint" # type: str self.time_ranges = time_ranges class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): """AzureWorkload SQL -specific restore. Specifically for full/diff restore. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureWorkloadSQLPointInTimeRestoreRequest. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureWorkloadSQLPointInTimeRestoreRequest All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -4568,7 +4874,7 @@ class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4587,43 +4893,43 @@ class AzureWorkloadSQLRestoreRequest(AzureWorkloadRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'should_use_alternate_target_location': {'key': 'shouldUseAlternateTargetLocation', 'type': 'bool'}, - 'is_non_recoverable': {'key': 'isNonRecoverable', 'type': 'bool'}, - 'alternate_directory_paths': {'key': 'alternateDirectoryPaths', 'type': '[SQLDataDirectoryMapping]'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "should_use_alternate_target_location": {"key": "shouldUseAlternateTargetLocation", "type": "bool"}, + "is_non_recoverable": {"key": "isNonRecoverable", "type": "bool"}, + "alternate_directory_paths": {"key": "alternateDirectoryPaths", "type": "[SQLDataDirectoryMapping]"}, } _subtype_map = { - 'object_type': {'AzureWorkloadSQLPointInTimeRestoreRequest': 'AzureWorkloadSQLPointInTimeRestoreRequest'} + "object_type": {"AzureWorkloadSQLPointInTimeRestoreRequest": "AzureWorkloadSQLPointInTimeRestoreRequest"} } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, should_use_alternate_target_location: Optional[bool] = None, is_non_recoverable: Optional[bool] = None, - alternate_directory_paths: Optional[List["SQLDataDirectoryMapping"]] = None, + alternate_directory_paths: Optional[List["_models.SQLDataDirectoryMapping"]] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -4635,7 +4941,7 @@ def __init__( :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4652,23 +4958,33 @@ def __init__( :paramtype alternate_directory_paths: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.SQLDataDirectoryMapping] """ - super(AzureWorkloadSQLRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, **kwargs) - self.object_type = 'AzureWorkloadSQLRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + **kwargs + ) + self.object_type = "AzureWorkloadSQLRestoreRequest" # type: str self.should_use_alternate_target_location = should_use_alternate_target_location self.is_non_recoverable = is_non_recoverable self.alternate_directory_paths = alternate_directory_paths -class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): +class AzureWorkloadSQLPointInTimeRestoreRequest( + AzureWorkloadSQLRestoreRequest +): # pylint: disable=too-many-instance-attributes """AzureWorkload SQL -specific restore. Specifically for PointInTime/Log restore. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM on which workload that was running @@ -4679,7 +4995,7 @@ class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): :ivar target_info: Details of target database. :vartype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :ivar recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :vartype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :ivar target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4700,41 +5016,41 @@ class AzureWorkloadSQLPointInTimeRestoreRequest(AzureWorkloadSQLRestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'target_info': {'key': 'targetInfo', 'type': 'TargetRestoreInfo'}, - 'recovery_mode': {'key': 'recoveryMode', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'should_use_alternate_target_location': {'key': 'shouldUseAlternateTargetLocation', 'type': 'bool'}, - 'is_non_recoverable': {'key': 'isNonRecoverable', 'type': 'bool'}, - 'alternate_directory_paths': {'key': 'alternateDirectoryPaths', 'type': '[SQLDataDirectoryMapping]'}, - 'point_in_time': {'key': 'pointInTime', 'type': 'iso-8601'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "target_info": {"key": "targetInfo", "type": "TargetRestoreInfo"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "should_use_alternate_target_location": {"key": "shouldUseAlternateTargetLocation", "type": "bool"}, + "is_non_recoverable": {"key": "isNonRecoverable", "type": "bool"}, + "alternate_directory_paths": {"key": "alternateDirectoryPaths", "type": "[SQLDataDirectoryMapping]"}, + "point_in_time": {"key": "pointInTime", "type": "iso-8601"}, } def __init__( self, *, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, property_bag: Optional[Dict[str, str]] = None, - target_info: Optional["TargetRestoreInfo"] = None, - recovery_mode: Optional[Union[str, "RecoveryMode"]] = None, + target_info: Optional["_models.TargetRestoreInfo"] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, target_virtual_machine_id: Optional[str] = None, should_use_alternate_target_location: Optional[bool] = None, is_non_recoverable: Optional[bool] = None, - alternate_directory_paths: Optional[List["SQLDataDirectoryMapping"]] = None, + alternate_directory_paths: Optional[List["_models.SQLDataDirectoryMapping"]] = None, point_in_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM on which workload that was @@ -4746,7 +5062,7 @@ def __init__( :paramtype target_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetRestoreInfo :keyword recovery_mode: Defines whether the current recovery mode is file restore or database - restore. Possible values include: "Invalid", "FileRecovery", "WorkloadRecovery". + restore. Known values are: "Invalid", "FileRecovery", and "WorkloadRecovery". :paramtype recovery_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryMode :keyword target_virtual_machine_id: This is the complete ARM Id of the target VM @@ -4765,12 +5081,23 @@ def __init__( :keyword point_in_time: PointInTime value. :paramtype point_in_time: ~datetime.datetime """ - super(AzureWorkloadSQLPointInTimeRestoreRequest, self).__init__(recovery_type=recovery_type, source_resource_id=source_resource_id, property_bag=property_bag, target_info=target_info, recovery_mode=recovery_mode, target_virtual_machine_id=target_virtual_machine_id, should_use_alternate_target_location=should_use_alternate_target_location, is_non_recoverable=is_non_recoverable, alternate_directory_paths=alternate_directory_paths, **kwargs) - self.object_type = 'AzureWorkloadSQLPointInTimeRestoreRequest' # type: str + super().__init__( + recovery_type=recovery_type, + source_resource_id=source_resource_id, + property_bag=property_bag, + target_info=target_info, + recovery_mode=recovery_mode, + target_virtual_machine_id=target_virtual_machine_id, + should_use_alternate_target_location=should_use_alternate_target_location, + is_non_recoverable=is_non_recoverable, + alternate_directory_paths=alternate_directory_paths, + **kwargs + ) + self.object_type = "AzureWorkloadSQLPointInTimeRestoreRequest" # type: str self.point_in_time = point_in_time -class AzureWorkloadSQLRecoveryPointExtendedInfo(msrest.serialization.Model): +class AzureWorkloadSQLRecoveryPointExtendedInfo(_serialization.Model): """Extended info class details. Variables are only populated by the server, and will be ignored when sending a request. @@ -4783,80 +5110,76 @@ class AzureWorkloadSQLRecoveryPointExtendedInfo(msrest.serialization.Model): """ _validation = { - 'data_directory_time_in_utc': {'readonly': True}, - 'data_directory_paths': {'readonly': True}, + "data_directory_time_in_utc": {"readonly": True}, + "data_directory_paths": {"readonly": True}, } _attribute_map = { - 'data_directory_time_in_utc': {'key': 'dataDirectoryTimeInUTC', 'type': 'iso-8601'}, - 'data_directory_paths': {'key': 'dataDirectoryPaths', 'type': '[SQLDataDirectory]'}, + "data_directory_time_in_utc": {"key": "dataDirectoryTimeInUTC", "type": "iso-8601"}, + "data_directory_paths": {"key": "dataDirectoryPaths", "type": "[SQLDataDirectory]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(AzureWorkloadSQLRecoveryPointExtendedInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.data_directory_time_in_utc = None self.data_directory_paths = None -class BackupManagementUsage(msrest.serialization.Model): +class BackupManagementUsage(_serialization.Model): """Backup management usages of a vault. - :ivar unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond". + :ivar unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", and "BytesPerSecond". :vartype unit: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.UsagesUnit :ivar quota_period: Quota period of usage. :vartype quota_period: str :ivar next_reset_time: Next reset time of usage. :vartype next_reset_time: ~datetime.datetime :ivar current_value: Current value of usage. - :vartype current_value: long + :vartype current_value: int :ivar limit: Limit of usage. - :vartype limit: long + :vartype limit: int :ivar name: Name of usage. :vartype name: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.NameInfo """ _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, - 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'NameInfo'}, + "unit": {"key": "unit", "type": "str"}, + "quota_period": {"key": "quotaPeriod", "type": "str"}, + "next_reset_time": {"key": "nextResetTime", "type": "iso-8601"}, + "current_value": {"key": "currentValue", "type": "int"}, + "limit": {"key": "limit", "type": "int"}, + "name": {"key": "name", "type": "NameInfo"}, } def __init__( self, *, - unit: Optional[Union[str, "UsagesUnit"]] = None, + unit: Optional[Union[str, "_models.UsagesUnit"]] = None, quota_period: Optional[str] = None, next_reset_time: Optional[datetime.datetime] = None, current_value: Optional[int] = None, limit: Optional[int] = None, - name: Optional["NameInfo"] = None, + name: Optional["_models.NameInfo"] = None, **kwargs ): """ - :keyword unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond". + :keyword unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", and "BytesPerSecond". :paramtype unit: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.UsagesUnit :keyword quota_period: Quota period of usage. :paramtype quota_period: str :keyword next_reset_time: Next reset time of usage. :paramtype next_reset_time: ~datetime.datetime :keyword current_value: Current value of usage. - :paramtype current_value: long + :paramtype current_value: int :keyword limit: Limit of usage. - :paramtype limit: long + :paramtype limit: int :keyword name: Name of usage. :paramtype name: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.NameInfo """ - super(BackupManagementUsage, self).__init__(**kwargs) + super().__init__(**kwargs) self.unit = unit self.quota_period = quota_period self.next_reset_time = next_reset_time @@ -4865,7 +5188,7 @@ def __init__( self.name = name -class BackupManagementUsageList(msrest.serialization.Model): +class BackupManagementUsageList(_serialization.Model): """Backup management usage for vault. :ivar value: The list of backup management usages for the given vault. @@ -4874,38 +5197,32 @@ class BackupManagementUsageList(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[BackupManagementUsage]'}, + "value": {"key": "value", "type": "[BackupManagementUsage]"}, } - def __init__( - self, - *, - value: Optional[List["BackupManagementUsage"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.BackupManagementUsage"]] = None, **kwargs): """ :keyword value: The list of backup management usages for the given vault. :paramtype value: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsage] """ - super(BackupManagementUsageList, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value -class BackupResourceConfig(msrest.serialization.Model): +class BackupResourceConfig(_serialization.Model): """The resource storage details. - :ivar storage_model_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :ivar storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageType - :ivar storage_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :ivar storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageType :ivar storage_type_state: Locked or Unlocked. Once a machine is registered against a resource, - the storageTypeState is always Locked. Possible values include: "Invalid", "Locked", - "Unlocked". + the storageTypeState is always Locked. Known values are: "Invalid", "Locked", and "Unlocked". :vartype storage_type_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageTypeState :ivar cross_region_restore_flag: Opt in details of Cross Region Restore feature. @@ -4913,39 +5230,39 @@ class BackupResourceConfig(msrest.serialization.Model): """ _attribute_map = { - 'storage_model_type': {'key': 'storageModelType', 'type': 'str'}, - 'storage_type': {'key': 'storageType', 'type': 'str'}, - 'storage_type_state': {'key': 'storageTypeState', 'type': 'str'}, - 'cross_region_restore_flag': {'key': 'crossRegionRestoreFlag', 'type': 'bool'}, + "storage_model_type": {"key": "storageModelType", "type": "str"}, + "storage_type": {"key": "storageType", "type": "str"}, + "storage_type_state": {"key": "storageTypeState", "type": "str"}, + "cross_region_restore_flag": {"key": "crossRegionRestoreFlag", "type": "bool"}, } def __init__( self, *, - storage_model_type: Optional[Union[str, "StorageType"]] = None, - storage_type: Optional[Union[str, "StorageType"]] = None, - storage_type_state: Optional[Union[str, "StorageTypeState"]] = None, + storage_model_type: Optional[Union[str, "_models.StorageType"]] = None, + storage_type: Optional[Union[str, "_models.StorageType"]] = None, + storage_type_state: Optional[Union[str, "_models.StorageTypeState"]] = None, cross_region_restore_flag: Optional[bool] = None, **kwargs ): """ - :keyword storage_model_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :keyword storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageType - :keyword storage_type: Storage type. Possible values include: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + :keyword storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageType :keyword storage_type_state: Locked or Unlocked. Once a machine is registered against a - resource, the storageTypeState is always Locked. Possible values include: "Invalid", "Locked", + resource, the storageTypeState is always Locked. Known values are: "Invalid", "Locked", and "Unlocked". :paramtype storage_type_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageTypeState :keyword cross_region_restore_flag: Opt in details of Cross Region Restore feature. :paramtype cross_region_restore_flag: bool """ - super(BackupResourceConfig, self).__init__(**kwargs) + super().__init__(**kwargs) self.storage_model_type = storage_model_type self.storage_type = storage_type self.storage_type_state = storage_type_state @@ -4966,7 +5283,7 @@ class BackupResourceConfigResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -4976,19 +5293,19 @@ class BackupResourceConfigResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BackupResourceConfig'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "BackupResourceConfig"}, } def __init__( @@ -4997,13 +5314,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["BackupResourceConfig"] = None, + properties: Optional["_models.BackupResourceConfig"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -5011,11 +5328,11 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfig """ - super(BackupResourceConfigResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class BEKDetails(msrest.serialization.Model): +class BEKDetails(_serialization.Model): """BEK is bitlocker encryption key. :ivar secret_url: Secret is BEK. @@ -5027,9 +5344,9 @@ class BEKDetails(msrest.serialization.Model): """ _attribute_map = { - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, - 'secret_vault_id': {'key': 'secretVaultId', 'type': 'str'}, - 'secret_data': {'key': 'secretData', 'type': 'str'}, + "secret_url": {"key": "secretUrl", "type": "str"}, + "secret_vault_id": {"key": "secretVaultId", "type": "str"}, + "secret_data": {"key": "secretData", "type": "str"}, } def __init__( @@ -5048,79 +5365,71 @@ def __init__( :keyword secret_data: BEK data. :paramtype secret_data: str """ - super(BEKDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.secret_url = secret_url self.secret_vault_id = secret_vault_id self.secret_data = secret_data -class BMSAADPropertiesQueryObject(msrest.serialization.Model): +class BMSAADPropertiesQueryObject(_serialization.Model): """Filters to list backup items. - :ivar backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for the backed up item. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType """ _attribute_map = { - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, } def __init__( - self, - *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - **kwargs + self, *, backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, **kwargs ): """ - :keyword backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType """ - super(BMSAADPropertiesQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.backup_management_type = backup_management_type -class BMSBackupSummariesQueryObject(msrest.serialization.Model): +class BMSBackupSummariesQueryObject(_serialization.Model): """Query parameters to fetch backup summaries. - :ivar type: Backup management type for this container. Possible values include: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + :ivar type: Backup management type for this container. Known values are: "Invalid", + "BackupProtectedItemCountSummary", and "BackupProtectionContainerCountSummary". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.Type """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - type: Optional[Union[str, "Type"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): """ - :keyword type: Backup management type for this container. Possible values include: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + :keyword type: Backup management type for this container. Known values are: "Invalid", + "BackupProtectedItemCountSummary", and "BackupProtectionContainerCountSummary". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.Type """ - super(BMSBackupSummariesQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type -class BMSRPQueryObject(msrest.serialization.Model): +class BMSRPQueryObject(_serialization.Model): """Filters to list backup copies. :ivar start_date: Backup copies created after this time. :vartype start_date: ~datetime.datetime :ivar end_date: Backup copies created before this time. :vartype end_date: ~datetime.datetime - :ivar restore_point_query_type: RestorePoint type. Possible values include: "Invalid", "Full", - "Log", "Differential", "FullAndDifferential", "All", "Incremental". + :ivar restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", "Log", + "Differential", "FullAndDifferential", "All", and "Incremental". :vartype restore_point_query_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointQueryType :ivar extended_info: In Get Recovery Point, it tells whether extended information about @@ -5131,11 +5440,11 @@ class BMSRPQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, - 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, - 'restore_point_query_type': {'key': 'restorePointQueryType', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'bool'}, - 'move_ready_rp_only': {'key': 'moveReadyRPOnly', 'type': 'bool'}, + "start_date": {"key": "startDate", "type": "iso-8601"}, + "end_date": {"key": "endDate", "type": "iso-8601"}, + "restore_point_query_type": {"key": "restorePointQueryType", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "bool"}, + "move_ready_rp_only": {"key": "moveReadyRPOnly", "type": "bool"}, } def __init__( @@ -5143,7 +5452,7 @@ def __init__( *, start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, - restore_point_query_type: Optional[Union[str, "RestorePointQueryType"]] = None, + restore_point_query_type: Optional[Union[str, "_models.RestorePointQueryType"]] = None, extended_info: Optional[bool] = None, move_ready_rp_only: Optional[bool] = None, **kwargs @@ -5153,8 +5462,8 @@ def __init__( :paramtype start_date: ~datetime.datetime :keyword end_date: Backup copies created before this time. :paramtype end_date: ~datetime.datetime - :keyword restore_point_query_type: RestorePoint type. Possible values include: "Invalid", - "Full", "Log", "Differential", "FullAndDifferential", "All", "Incremental". + :keyword restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", + "Log", "Differential", "FullAndDifferential", "All", and "Incremental". :paramtype restore_point_query_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestorePointQueryType :keyword extended_info: In Get Recovery Point, it tells whether extended information about @@ -5163,7 +5472,7 @@ def __init__( :keyword move_ready_rp_only: Whether the RP can be moved to another tier. :paramtype move_ready_rp_only: bool """ - super(BMSRPQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.start_date = start_date self.end_date = end_date self.restore_point_query_type = restore_point_query_type @@ -5171,7 +5480,7 @@ def __init__( self.move_ready_rp_only = move_ready_rp_only -class ClientScriptForConnect(msrest.serialization.Model): +class ClientScriptForConnect(_serialization.Model): """Client script details for file / folder restore. :ivar script_content: File content of the client script for file / folder restore. @@ -5192,11 +5501,11 @@ class ClientScriptForConnect(msrest.serialization.Model): """ _attribute_map = { - 'script_content': {'key': 'scriptContent', 'type': 'str'}, - 'script_extension': {'key': 'scriptExtension', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'url': {'key': 'url', 'type': 'str'}, - 'script_name_suffix': {'key': 'scriptNameSuffix', 'type': 'str'}, + "script_content": {"key": "scriptContent", "type": "str"}, + "script_extension": {"key": "scriptExtension", "type": "str"}, + "os_type": {"key": "osType", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "script_name_suffix": {"key": "scriptNameSuffix", "type": "str"}, } def __init__( @@ -5226,7 +5535,7 @@ def __init__( If its null or empty then , ignore it. :paramtype script_name_suffix: str """ - super(ClientScriptForConnect, self).__init__(**kwargs) + super().__init__(**kwargs) self.script_content = script_content self.script_extension = script_extension self.os_type = os_type @@ -5234,7 +5543,7 @@ def __init__( self.script_name_suffix = script_name_suffix -class CrossRegionRestoreRequest(msrest.serialization.Model): +class CrossRegionRestoreRequest(_serialization.Model): """CrossRegionRestoreRequest. :ivar cross_region_restore_access_details: Access details for cross region restore. @@ -5245,15 +5554,15 @@ class CrossRegionRestoreRequest(msrest.serialization.Model): """ _attribute_map = { - 'cross_region_restore_access_details': {'key': 'crossRegionRestoreAccessDetails', 'type': 'CrrAccessToken'}, - 'restore_request': {'key': 'restoreRequest', 'type': 'RestoreRequest'}, + "cross_region_restore_access_details": {"key": "crossRegionRestoreAccessDetails", "type": "CrrAccessToken"}, + "restore_request": {"key": "restoreRequest", "type": "RestoreRequest"}, } def __init__( self, *, - cross_region_restore_access_details: Optional["CrrAccessToken"] = None, - restore_request: Optional["RestoreRequest"] = None, + cross_region_restore_access_details: Optional["_models.CrrAccessToken"] = None, + restore_request: Optional["_models.RestoreRequest"] = None, **kwargs ): """ @@ -5264,7 +5573,7 @@ def __init__( :paramtype restore_request: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RestoreRequest """ - super(CrossRegionRestoreRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.cross_region_restore_access_details = cross_region_restore_access_details self.restore_request = restore_request @@ -5283,7 +5592,7 @@ class CrossRegionRestoreRequestResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -5293,19 +5602,19 @@ class CrossRegionRestoreRequestResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CrossRegionRestoreRequest'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "CrossRegionRestoreRequest"}, } def __init__( @@ -5314,13 +5623,13 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["CrossRegionRestoreRequest"] = None, + properties: Optional["_models.CrossRegionRestoreRequest"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str @@ -5328,20 +5637,19 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrossRegionRestoreRequest """ - super(CrossRegionRestoreRequestResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class CrrAccessToken(msrest.serialization.Model): +class CrrAccessToken(_serialization.Model): # pylint: disable=too-many-instance-attributes """CrrAccessToken. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: WorkloadCrrAccessToken. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + WorkloadCrrAccessToken All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. + :ivar object_type: Type of the specific object - used for deserializing. Required. :vartype object_type: str :ivar access_token_string: Access token used for authentication. :vartype access_token_string: str @@ -5354,7 +5662,7 @@ class CrrAccessToken(msrest.serialization.Model): :ivar resource_id: Resource Id of the source vault. :vartype resource_id: str :ivar protection_container_id: Protected item container id. - :vartype protection_container_id: long + :vartype protection_container_id: int :ivar recovery_point_id: Recovery Point Id. :vartype recovery_point_id: str :ivar recovery_point_time: Recovery Point Time. @@ -5399,43 +5707,41 @@ class CrrAccessToken(msrest.serialization.Model): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'access_token_string': {'key': 'accessTokenString', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'protection_container_id': {'key': 'protectionContainerId', 'type': 'long'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'datasource_type': {'key': 'datasourceType', 'type': 'str'}, - 'datasource_name': {'key': 'datasourceName', 'type': 'str'}, - 'datasource_id': {'key': 'datasourceId', 'type': 'str'}, - 'datasource_container_name': {'key': 'datasourceContainerName', 'type': 'str'}, - 'coordinator_service_stamp_id': {'key': 'coordinatorServiceStampId', 'type': 'str'}, - 'coordinator_service_stamp_uri': {'key': 'coordinatorServiceStampUri', 'type': 'str'}, - 'protection_service_stamp_id': {'key': 'protectionServiceStampId', 'type': 'str'}, - 'protection_service_stamp_uri': {'key': 'protectionServiceStampUri', 'type': 'str'}, - 'token_extended_information': {'key': 'tokenExtendedInformation', 'type': 'str'}, - 'rp_tier_information': {'key': 'rpTierInformation', 'type': '{str}'}, - 'rp_original_sa_option': {'key': 'rpOriginalSAOption', 'type': 'bool'}, - 'rp_is_managed_virtual_machine': {'key': 'rpIsManagedVirtualMachine', 'type': 'bool'}, - 'rp_vm_size_description': {'key': 'rpVMSizeDescription', 'type': 'str'}, - 'b_ms_active_region': {'key': 'bMSActiveRegion', 'type': 'str'}, - } - - _subtype_map = { - 'object_type': {'WorkloadCrrAccessToken': 'WorkloadCrrAccessToken'} - } - - def __init__( + "object_type": {"key": "objectType", "type": "str"}, + "access_token_string": {"key": "accessTokenString", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "resource_group_name": {"key": "resourceGroupName", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "protection_container_id": {"key": "protectionContainerId", "type": "int"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "datasource_type": {"key": "datasourceType", "type": "str"}, + "datasource_name": {"key": "datasourceName", "type": "str"}, + "datasource_id": {"key": "datasourceId", "type": "str"}, + "datasource_container_name": {"key": "datasourceContainerName", "type": "str"}, + "coordinator_service_stamp_id": {"key": "coordinatorServiceStampId", "type": "str"}, + "coordinator_service_stamp_uri": {"key": "coordinatorServiceStampUri", "type": "str"}, + "protection_service_stamp_id": {"key": "protectionServiceStampId", "type": "str"}, + "protection_service_stamp_uri": {"key": "protectionServiceStampUri", "type": "str"}, + "token_extended_information": {"key": "tokenExtendedInformation", "type": "str"}, + "rp_tier_information": {"key": "rpTierInformation", "type": "{str}"}, + "rp_original_sa_option": {"key": "rpOriginalSAOption", "type": "bool"}, + "rp_is_managed_virtual_machine": {"key": "rpIsManagedVirtualMachine", "type": "bool"}, + "rp_vm_size_description": {"key": "rpVMSizeDescription", "type": "str"}, + "b_ms_active_region": {"key": "bMSActiveRegion", "type": "str"}, + } + + _subtype_map = {"object_type": {"WorkloadCrrAccessToken": "WorkloadCrrAccessToken"}} + + def __init__( # pylint: disable=too-many-locals self, *, access_token_string: Optional[str] = None, @@ -5477,7 +5783,7 @@ def __init__( :keyword resource_id: Resource Id of the source vault. :paramtype resource_id: str :keyword protection_container_id: Protected item container id. - :paramtype protection_container_id: long + :paramtype protection_container_id: int :keyword recovery_point_id: Recovery Point Id. :paramtype recovery_point_id: str :keyword recovery_point_time: Recovery Point Time. @@ -5521,7 +5827,7 @@ def __init__( :keyword b_ms_active_region: Active region name of BMS Stamp. :paramtype b_ms_active_region: str """ - super(CrrAccessToken, self).__init__(**kwargs) + super().__init__(**kwargs) self.object_type = None # type: Optional[str] self.access_token_string = access_token_string self.subscription_id = subscription_id @@ -5564,7 +5870,7 @@ class CrrAccessTokenResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -5573,19 +5879,19 @@ class CrrAccessTokenResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CrrAccessToken'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "CrrAccessToken"}, } def __init__( @@ -5594,24 +5900,24 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["CrrAccessToken"] = None, + properties: Optional["_models.CrrAccessToken"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: CrrAccessTokenResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessToken """ - super(CrrAccessTokenResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class CrrJobRequest(msrest.serialization.Model): +class CrrJobRequest(_serialization.Model): """Request object for fetching CRR jobs. :ivar resource_id: Entire ARM resource id of the resource. @@ -5621,24 +5927,18 @@ class CrrJobRequest(msrest.serialization.Model): """ _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'job_name': {'key': 'jobName', 'type': 'str'}, + "resource_id": {"key": "resourceId", "type": "str"}, + "job_name": {"key": "jobName", "type": "str"}, } - def __init__( - self, - *, - resource_id: Optional[str] = None, - job_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, resource_id: Optional[str] = None, job_name: Optional[str] = None, **kwargs): """ :keyword resource_id: Entire ARM resource id of the resource. :paramtype resource_id: str :keyword job_name: Job Name of the job to be fetched. :paramtype job_name: str """ - super(CrrJobRequest, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_id = resource_id self.job_name = job_name @@ -5657,7 +5957,7 @@ class CrrJobRequestResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -5666,19 +5966,19 @@ class CrrJobRequestResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CrrJobRequest'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "CrrJobRequest"}, } def __init__( @@ -5687,24 +5987,24 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["CrrJobRequest"] = None, + properties: Optional["_models.CrrJobRequest"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: CrrJobRequestResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest """ - super(CrrJobRequestResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class DiskExclusionProperties(msrest.serialization.Model): +class DiskExclusionProperties(_serialization.Model): """DiskExclusionProperties. :ivar disk_lun_list: List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. @@ -5715,16 +6015,12 @@ class DiskExclusionProperties(msrest.serialization.Model): """ _attribute_map = { - 'disk_lun_list': {'key': 'diskLunList', 'type': '[int]'}, - 'is_inclusion_list': {'key': 'isInclusionList', 'type': 'bool'}, + "disk_lun_list": {"key": "diskLunList", "type": "[int]"}, + "is_inclusion_list": {"key": "isInclusionList", "type": "bool"}, } def __init__( - self, - *, - disk_lun_list: Optional[List[int]] = None, - is_inclusion_list: Optional[bool] = None, - **kwargs + self, *, disk_lun_list: Optional[List[int]] = None, is_inclusion_list: Optional[bool] = None, **kwargs ): """ :keyword disk_lun_list: List of Disks' Logical Unit Numbers (LUN) to be used for VM Protection. @@ -5733,12 +6029,12 @@ def __init__( from backup. :paramtype is_inclusion_list: bool """ - super(DiskExclusionProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_lun_list = disk_lun_list self.is_inclusion_list = is_inclusion_list -class DiskInformation(msrest.serialization.Model): +class DiskInformation(_serialization.Model): """Disk information. :ivar lun: @@ -5748,29 +6044,23 @@ class DiskInformation(msrest.serialization.Model): """ _attribute_map = { - 'lun': {'key': 'lun', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, + "lun": {"key": "lun", "type": "int"}, + "name": {"key": "name", "type": "str"}, } - def __init__( - self, - *, - lun: Optional[int] = None, - name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, lun: Optional[int] = None, name: Optional[str] = None, **kwargs): """ :keyword lun: :paramtype lun: int :keyword name: :paramtype name: str """ - super(DiskInformation, self).__init__(**kwargs) + super().__init__(**kwargs) self.lun = lun self.name = name -class DpmErrorInfo(msrest.serialization.Model): +class DpmErrorInfo(_serialization.Model): """DPM workload-specific error information. :ivar error_string: Localized error string. @@ -5780,38 +6070,32 @@ class DpmErrorInfo(msrest.serialization.Model): """ _attribute_map = { - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - *, - error_string: Optional[str] = None, - recommendations: Optional[List[str]] = None, - **kwargs - ): + def __init__(self, *, error_string: Optional[str] = None, recommendations: Optional[List[str]] = None, **kwargs): """ :keyword error_string: Localized error string. :paramtype error_string: str :keyword recommendations: List of localized recommendations for above error code. :paramtype recommendations: list[str] """ - super(DpmErrorInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.error_string = error_string self.recommendations = recommendations -class DpmJob(Job): +class DpmJob(Job): # pylint: disable=too-many-instance-attributes """DPM workload-specific job object. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :ivar operation: The operation name. @@ -5824,8 +6108,8 @@ class DpmJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time elapsed for job. :vartype duration: ~datetime.timedelta @@ -5849,33 +6133,33 @@ class DpmJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'dpm_server_name': {'key': 'dpmServerName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'error_details': {'key': 'errorDetails', 'type': '[DpmErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'DpmJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "dpm_server_name": {"key": "dpmServerName", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "error_details": {"key": "errorDetails", "type": "[DpmErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "DpmJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, @@ -5886,18 +6170,18 @@ def __init__( container_name: Optional[str] = None, container_type: Optional[str] = None, workload_type: Optional[str] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, - error_details: Optional[List["DpmErrorInfo"]] = None, - extended_info: Optional["DpmJobExtendedInfo"] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, + error_details: Optional[List["_models.DpmErrorInfo"]] = None, + extended_info: Optional["_models.DpmJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -5930,8 +6214,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DpmJobExtendedInfo """ - super(DpmJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'DpmJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "DpmJob" # type: str self.duration = duration self.dpm_server_name = dpm_server_name self.container_name = container_name @@ -5942,7 +6235,7 @@ def __init__( self.extended_info = extended_info -class DpmJobExtendedInfo(msrest.serialization.Model): +class DpmJobExtendedInfo(_serialization.Model): """Additional information on the DPM workload-specific job. :ivar tasks_list: List of tasks associated with this job. @@ -5955,15 +6248,15 @@ class DpmJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[DpmJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[DpmJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["DpmJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.DpmJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -5977,13 +6270,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message on job execution. :paramtype dynamic_error_message: str """ - super(DpmJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class DpmJobTaskDetails(msrest.serialization.Model): +class DpmJobTaskDetails(_serialization.Model): """DPM workload-specific job task details. :ivar task_id: The task display name. @@ -5999,11 +6292,11 @@ class DpmJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "duration": {"key": "duration", "type": "duration"}, + "status": {"key": "status", "type": "str"}, } def __init__( @@ -6028,7 +6321,7 @@ def __init__( :keyword status: The status. :paramtype status: str """ - super(DpmJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.start_time = start_time self.end_time = end_time @@ -6036,21 +6329,21 @@ def __init__( self.status = status -class DPMProtectedItem(ProtectedItem): +class DPMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Additional information on Backup engine specific backup item. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -6066,7 +6359,7 @@ class DPMProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -6088,9 +6381,8 @@ class DPMProtectedItem(ProtectedItem): :vartype friendly_name: str :ivar backup_engine_name: Backup Management server protecting this backup item. :vartype backup_engine_name: str - :ivar protection_state: Protection state of the backup engine. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :ivar protection_state: Protection state of the backup engine. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemState :ivar extended_info: Extended info of the backup item. @@ -6099,42 +6391,42 @@ class DPMProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'backup_engine_name': {'key': 'backupEngineName', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'DPMProtectedItemExtendedInfo'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "backup_engine_name": {"key": "backupEngineName", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "DPMProtectedItemExtendedInfo"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -6143,20 +6435,20 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, friendly_name: Optional[str] = None, backup_engine_name: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectedItemState"]] = None, - extended_info: Optional["DPMProtectedItemExtendedInfo"] = None, + protection_state: Optional[Union[str, "_models.ProtectedItemState"]] = None, + extended_info: Optional["_models.DPMProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -6171,7 +6463,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -6195,24 +6487,39 @@ def __init__( :paramtype friendly_name: str :keyword backup_engine_name: Backup Management server protecting this backup item. :paramtype backup_engine_name: str - :keyword protection_state: Protection state of the backup engine. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Protection state of the backup engine. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemState :keyword extended_info: Extended info of the backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DPMProtectedItemExtendedInfo """ - super(DPMProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'DPMProtectedItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "DPMProtectedItem" # type: str self.friendly_name = friendly_name self.backup_engine_name = backup_engine_name self.protection_state = protection_state self.extended_info = extended_info -class DPMProtectedItemExtendedInfo(msrest.serialization.Model): +class DPMProtectedItemExtendedInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes """Additional information of DPM Protected item. :ivar protectable_object_load_path: Attribute to provide information on various DBs. @@ -6246,20 +6553,20 @@ class DPMProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'protectable_object_load_path': {'key': 'protectableObjectLoadPath', 'type': '{str}'}, - 'protected': {'key': 'protected', 'type': 'bool'}, - 'is_present_on_cloud': {'key': 'isPresentOnCloud', 'type': 'bool'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_refreshed_at': {'key': 'lastRefreshedAt', 'type': 'iso-8601'}, - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, - 'on_premise_oldest_recovery_point': {'key': 'onPremiseOldestRecoveryPoint', 'type': 'iso-8601'}, - 'on_premise_latest_recovery_point': {'key': 'onPremiseLatestRecoveryPoint', 'type': 'iso-8601'}, - 'on_premise_recovery_point_count': {'key': 'onPremiseRecoveryPointCount', 'type': 'int'}, - 'is_collocated': {'key': 'isCollocated', 'type': 'bool'}, - 'protection_group_name': {'key': 'protectionGroupName', 'type': 'str'}, - 'disk_storage_used_in_bytes': {'key': 'diskStorageUsedInBytes', 'type': 'str'}, - 'total_disk_storage_size_in_bytes': {'key': 'totalDiskStorageSizeInBytes', 'type': 'str'}, + "protectable_object_load_path": {"key": "protectableObjectLoadPath", "type": "{str}"}, + "protected": {"key": "protected", "type": "bool"}, + "is_present_on_cloud": {"key": "isPresentOnCloud", "type": "bool"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_refreshed_at": {"key": "lastRefreshedAt", "type": "iso-8601"}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, + "on_premise_oldest_recovery_point": {"key": "onPremiseOldestRecoveryPoint", "type": "iso-8601"}, + "on_premise_latest_recovery_point": {"key": "onPremiseLatestRecoveryPoint", "type": "iso-8601"}, + "on_premise_recovery_point_count": {"key": "onPremiseRecoveryPointCount", "type": "int"}, + "is_collocated": {"key": "isCollocated", "type": "bool"}, + "protection_group_name": {"key": "protectionGroupName", "type": "str"}, + "disk_storage_used_in_bytes": {"key": "diskStorageUsedInBytes", "type": "str"}, + "total_disk_storage_size_in_bytes": {"key": "totalDiskStorageSizeInBytes", "type": "str"}, } def __init__( @@ -6311,7 +6618,7 @@ def __init__( :keyword total_disk_storage_size_in_bytes: total Disk storage in bytes. :paramtype total_disk_storage_size_in_bytes: str """ - super(DPMProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.protectable_object_load_path = protectable_object_load_path self.protected = protected self.is_present_on_cloud = is_present_on_cloud @@ -6328,7 +6635,7 @@ def __init__( self.total_disk_storage_size_in_bytes = total_disk_storage_size_in_bytes -class EncryptionDetails(msrest.serialization.Model): +class EncryptionDetails(_serialization.Model): """Details needed if the VM was encrypted at the time of backup. :ivar encryption_enabled: Identifies whether this backup copy represents an encrypted VM at the @@ -6345,11 +6652,11 @@ class EncryptionDetails(msrest.serialization.Model): """ _attribute_map = { - 'encryption_enabled': {'key': 'encryptionEnabled', 'type': 'bool'}, - 'kek_url': {'key': 'kekUrl', 'type': 'str'}, - 'secret_key_url': {'key': 'secretKeyUrl', 'type': 'str'}, - 'kek_vault_id': {'key': 'kekVaultId', 'type': 'str'}, - 'secret_key_vault_id': {'key': 'secretKeyVaultId', 'type': 'str'}, + "encryption_enabled": {"key": "encryptionEnabled", "type": "bool"}, + "kek_url": {"key": "kekUrl", "type": "str"}, + "secret_key_url": {"key": "secretKeyUrl", "type": "str"}, + "kek_vault_id": {"key": "kekVaultId", "type": "str"}, + "secret_key_vault_id": {"key": "secretKeyVaultId", "type": "str"}, } def __init__( @@ -6375,7 +6682,7 @@ def __init__( :keyword secret_key_vault_id: ID of Key Vault where Secret is stored. :paramtype secret_key_vault_id: str """ - super(EncryptionDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.encryption_enabled = encryption_enabled self.kek_url = kek_url self.secret_key_url = secret_key_url @@ -6383,7 +6690,7 @@ def __init__( self.secret_key_vault_id = secret_key_vault_id -class ErrorAdditionalInfo(msrest.serialization.Model): +class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. @@ -6391,31 +6698,27 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: any + :vartype info: JSON """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorAdditionalInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.type = None self.info = None -class ErrorDetail(msrest.serialization.Model): +class ErrorDetail(_serialization.Model): """Error Detail class which encapsulates Code, Message and Recommendations. Variables are only populated by the server, and will be ignored when sending a request. @@ -6429,30 +6732,26 @@ class ErrorDetail(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'recommendations': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(ErrorDetail, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.recommendations = None -class ExtendedProperties(msrest.serialization.Model): +class ExtendedProperties(_serialization.Model): """Extended Properties for Azure IaasVM Backup. :ivar disk_exclusion_properties: Extended Properties for Disk Exclusion. @@ -6461,39 +6760,34 @@ class ExtendedProperties(msrest.serialization.Model): """ _attribute_map = { - 'disk_exclusion_properties': {'key': 'diskExclusionProperties', 'type': 'DiskExclusionProperties'}, + "disk_exclusion_properties": {"key": "diskExclusionProperties", "type": "DiskExclusionProperties"}, } - def __init__( - self, - *, - disk_exclusion_properties: Optional["DiskExclusionProperties"] = None, - **kwargs - ): + def __init__(self, *, disk_exclusion_properties: Optional["_models.DiskExclusionProperties"] = None, **kwargs): """ :keyword disk_exclusion_properties: Extended Properties for Disk Exclusion. :paramtype disk_exclusion_properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DiskExclusionProperties """ - super(ExtendedProperties, self).__init__(**kwargs) + super().__init__(**kwargs) self.disk_exclusion_properties = disk_exclusion_properties -class GenericProtectedItem(ProtectedItem): +class GenericProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """Base class for backup items. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -6509,7 +6803,7 @@ class GenericProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -6532,12 +6826,12 @@ class GenericProtectedItem(ProtectedItem): :ivar policy_state: Indicates consistency of policy object and policy applied to this backup item. :vartype policy_state: str - :ivar protection_state: Backup state of this backup item. Possible values include: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :ivar protected_item_id: Data Plane Service ID of the protected item. - :vartype protected_item_id: long + :vartype protected_item_id: int :ivar source_associations: Loosely coupled (type, value) associations (example - parent of a protected item). :vartype source_associations: dict[str, str] @@ -6546,44 +6840,44 @@ class GenericProtectedItem(ProtectedItem): """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'policy_state': {'key': 'policyState', 'type': 'str'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'protected_item_id': {'key': 'protectedItemId', 'type': 'long'}, - 'source_associations': {'key': 'sourceAssociations', 'type': '{str}'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "policy_state": {"key": "policyState", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "protected_item_id": {"key": "protectedItemId", "type": "int"}, + "source_associations": {"key": "sourceAssociations", "type": "{str}"}, + "fabric_name": {"key": "fabricName", "type": "str"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -6592,22 +6886,22 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, friendly_name: Optional[str] = None, policy_state: Optional[str] = None, - protection_state: Optional[Union[str, "ProtectionState"]] = None, + protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, protected_item_id: Optional[int] = None, source_associations: Optional[Dict[str, str]] = None, fabric_name: Optional[str] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -6622,7 +6916,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -6647,21 +6941,36 @@ def __init__( :keyword policy_state: Indicates consistency of policy object and policy applied to this backup item. :paramtype policy_state: str - :keyword protection_state: Backup state of this backup item. Possible values include: - "Invalid", "IRPending", "Protected", "ProtectionError", "ProtectionStopped", - "ProtectionPaused". + :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectionState :keyword protected_item_id: Data Plane Service ID of the protected item. - :paramtype protected_item_id: long + :paramtype protected_item_id: int :keyword source_associations: Loosely coupled (type, value) associations (example - parent of a protected item). :paramtype source_associations: dict[str, str] :keyword fabric_name: Name of this backup item's fabric. :paramtype fabric_name: str """ - super(GenericProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'GenericProtectedItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "GenericProtectedItem" # type: str self.friendly_name = friendly_name self.policy_state = policy_state self.protection_state = protection_state @@ -6675,8 +6984,8 @@ class GenericRecoveryPoint(RecoveryPoint): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar friendly_name: Friendly name of the backup copy. :vartype friendly_name: str @@ -6689,15 +6998,15 @@ class GenericRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_additional_info': {'key': 'recoveryPointAdditionalInfo', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "recovery_point_additional_info": {"key": "recoveryPointAdditionalInfo", "type": "str"}, } def __init__( @@ -6720,23 +7029,23 @@ def __init__( copy. :paramtype recovery_point_additional_info: str """ - super(GenericRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'GenericRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "GenericRecoveryPoint" # type: str self.friendly_name = friendly_name self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time self.recovery_point_additional_info = recovery_point_additional_info -class IaasVMRecoveryPoint(RecoveryPoint): +class IaasVMRecoveryPoint(RecoveryPoint): # pylint: disable=too-many-instance-attributes """IaaS VM workload specific backup copy. 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 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. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_type: Type of the backup copy. :vartype recovery_point_type: str @@ -6779,46 +7088,52 @@ class IaasVMRecoveryPoint(RecoveryPoint): """ _validation = { - 'object_type': {'required': True}, - 'recovery_point_type': {'readonly': True}, - 'recovery_point_time': {'readonly': True}, - 'recovery_point_additional_info': {'readonly': True}, - 'source_vm_storage_type': {'readonly': True}, - 'is_source_vm_encrypted': {'readonly': True}, + "object_type": {"required": True}, + "recovery_point_type": {"readonly": True}, + "recovery_point_time": {"readonly": True}, + "recovery_point_additional_info": {"readonly": True}, + "source_vm_storage_type": {"readonly": True}, + "is_source_vm_encrypted": {"readonly": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_type': {'key': 'recoveryPointType', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'iso-8601'}, - 'recovery_point_additional_info': {'key': 'recoveryPointAdditionalInfo', 'type': 'str'}, - 'source_vm_storage_type': {'key': 'sourceVMStorageType', 'type': 'str'}, - 'is_source_vm_encrypted': {'key': 'isSourceVMEncrypted', 'type': 'bool'}, - 'key_and_secret': {'key': 'keyAndSecret', 'type': 'KeyAndSecretDetails'}, - 'is_instant_ilr_session_active': {'key': 'isInstantIlrSessionActive', 'type': 'bool'}, - 'recovery_point_tier_details': {'key': 'recoveryPointTierDetails', 'type': '[RecoveryPointTierInformation]'}, - 'is_managed_virtual_machine': {'key': 'isManagedVirtualMachine', 'type': 'bool'}, - 'virtual_machine_size': {'key': 'virtualMachineSize', 'type': 'str'}, - 'original_storage_account_option': {'key': 'originalStorageAccountOption', 'type': 'bool'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'recovery_point_disk_configuration': {'key': 'recoveryPointDiskConfiguration', 'type': 'RecoveryPointDiskConfiguration'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'recovery_point_move_readiness_info': {'key': 'recoveryPointMoveReadinessInfo', 'type': '{RecoveryPointMoveReadinessInfo}'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, + "recovery_point_additional_info": {"key": "recoveryPointAdditionalInfo", "type": "str"}, + "source_vm_storage_type": {"key": "sourceVMStorageType", "type": "str"}, + "is_source_vm_encrypted": {"key": "isSourceVMEncrypted", "type": "bool"}, + "key_and_secret": {"key": "keyAndSecret", "type": "KeyAndSecretDetails"}, + "is_instant_ilr_session_active": {"key": "isInstantIlrSessionActive", "type": "bool"}, + "recovery_point_tier_details": {"key": "recoveryPointTierDetails", "type": "[RecoveryPointTierInformation]"}, + "is_managed_virtual_machine": {"key": "isManagedVirtualMachine", "type": "bool"}, + "virtual_machine_size": {"key": "virtualMachineSize", "type": "str"}, + "original_storage_account_option": {"key": "originalStorageAccountOption", "type": "bool"}, + "os_type": {"key": "osType", "type": "str"}, + "recovery_point_disk_configuration": { + "key": "recoveryPointDiskConfiguration", + "type": "RecoveryPointDiskConfiguration", + }, + "zones": {"key": "zones", "type": "[str]"}, + "recovery_point_move_readiness_info": { + "key": "recoveryPointMoveReadinessInfo", + "type": "{RecoveryPointMoveReadinessInfo}", + }, } def __init__( self, *, - key_and_secret: Optional["KeyAndSecretDetails"] = None, + key_and_secret: Optional["_models.KeyAndSecretDetails"] = None, is_instant_ilr_session_active: Optional[bool] = None, - recovery_point_tier_details: Optional[List["RecoveryPointTierInformation"]] = None, + recovery_point_tier_details: Optional[List["_models.RecoveryPointTierInformation"]] = None, is_managed_virtual_machine: Optional[bool] = None, virtual_machine_size: Optional[str] = None, original_storage_account_option: Optional[bool] = None, os_type: Optional[str] = None, - recovery_point_disk_configuration: Optional["RecoveryPointDiskConfiguration"] = None, + recovery_point_disk_configuration: Optional["_models.RecoveryPointDiskConfiguration"] = None, zones: Optional[List[str]] = None, - recovery_point_move_readiness_info: Optional[Dict[str, "RecoveryPointMoveReadinessInfo"]] = None, + recovery_point_move_readiness_info: Optional[Dict[str, "_models.RecoveryPointMoveReadinessInfo"]] = None, **kwargs ): """ @@ -6850,8 +7165,8 @@ def __init__( :paramtype recovery_point_move_readiness_info: dict[str, ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointMoveReadinessInfo] """ - super(IaasVMRecoveryPoint, self).__init__(**kwargs) - self.object_type = 'IaasVMRecoveryPoint' # type: str + super().__init__(**kwargs) + self.object_type = "IaasVMRecoveryPoint" # type: str self.recovery_point_type = None self.recovery_point_time = None self.recovery_point_additional_info = None @@ -6869,18 +7184,18 @@ def __init__( self.recovery_point_move_readiness_info = recovery_point_move_readiness_info -class IaasVMRestoreRequest(RestoreRequest): +class IaasVMRestoreRequest(RestoreRequest): # pylint: disable=too-many-instance-attributes """IaaS VM workload-specific restore. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_point_id: ID of the backup copy to be recovered. :vartype recovery_point_id: str - :ivar recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :ivar recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :vartype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :ivar source_resource_id: Fully qualified ARM ID of the VM which is being recovered. @@ -6943,38 +7258,38 @@ class IaasVMRestoreRequest(RestoreRequest): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_type': {'key': 'recoveryType', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'target_virtual_machine_id': {'key': 'targetVirtualMachineId', 'type': 'str'}, - 'target_resource_group_id': {'key': 'targetResourceGroupId', 'type': 'str'}, - 'storage_account_id': {'key': 'storageAccountId', 'type': 'str'}, - 'virtual_network_id': {'key': 'virtualNetworkId', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'target_domain_name_id': {'key': 'targetDomainNameId', 'type': 'str'}, - 'region': {'key': 'region', 'type': 'str'}, - 'affinity_group': {'key': 'affinityGroup', 'type': 'str'}, - 'create_new_cloud_service': {'key': 'createNewCloudService', 'type': 'bool'}, - 'original_storage_account_option': {'key': 'originalStorageAccountOption', 'type': 'bool'}, - 'encryption_details': {'key': 'encryptionDetails', 'type': 'EncryptionDetails'}, - 'restore_disk_lun_list': {'key': 'restoreDiskLunList', 'type': '[int]'}, - 'restore_with_managed_disks': {'key': 'restoreWithManagedDisks', 'type': 'bool'}, - 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'identity_info': {'key': 'identityInfo', 'type': 'IdentityInfo'}, - 'identity_based_restore_details': {'key': 'identityBasedRestoreDetails', 'type': 'IdentityBasedRestoreDetails'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "recovery_type": {"key": "recoveryType", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "target_virtual_machine_id": {"key": "targetVirtualMachineId", "type": "str"}, + "target_resource_group_id": {"key": "targetResourceGroupId", "type": "str"}, + "storage_account_id": {"key": "storageAccountId", "type": "str"}, + "virtual_network_id": {"key": "virtualNetworkId", "type": "str"}, + "subnet_id": {"key": "subnetId", "type": "str"}, + "target_domain_name_id": {"key": "targetDomainNameId", "type": "str"}, + "region": {"key": "region", "type": "str"}, + "affinity_group": {"key": "affinityGroup", "type": "str"}, + "create_new_cloud_service": {"key": "createNewCloudService", "type": "bool"}, + "original_storage_account_option": {"key": "originalStorageAccountOption", "type": "bool"}, + "encryption_details": {"key": "encryptionDetails", "type": "EncryptionDetails"}, + "restore_disk_lun_list": {"key": "restoreDiskLunList", "type": "[int]"}, + "restore_with_managed_disks": {"key": "restoreWithManagedDisks", "type": "bool"}, + "disk_encryption_set_id": {"key": "diskEncryptionSetId", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + "identity_info": {"key": "identityInfo", "type": "IdentityInfo"}, + "identity_based_restore_details": {"key": "identityBasedRestoreDetails", "type": "IdentityBasedRestoreDetails"}, } def __init__( self, *, recovery_point_id: Optional[str] = None, - recovery_type: Optional[Union[str, "RecoveryType"]] = None, + recovery_type: Optional[Union[str, "_models.RecoveryType"]] = None, source_resource_id: Optional[str] = None, target_virtual_machine_id: Optional[str] = None, target_resource_group_id: Optional[str] = None, @@ -6986,20 +7301,20 @@ def __init__( affinity_group: Optional[str] = None, create_new_cloud_service: Optional[bool] = None, original_storage_account_option: Optional[bool] = None, - encryption_details: Optional["EncryptionDetails"] = None, + encryption_details: Optional["_models.EncryptionDetails"] = None, restore_disk_lun_list: Optional[List[int]] = None, restore_with_managed_disks: Optional[bool] = None, disk_encryption_set_id: Optional[str] = None, zones: Optional[List[str]] = None, - identity_info: Optional["IdentityInfo"] = None, - identity_based_restore_details: Optional["IdentityBasedRestoreDetails"] = None, + identity_info: Optional["_models.IdentityInfo"] = None, + identity_based_restore_details: Optional["_models.IdentityBasedRestoreDetails"] = None, **kwargs ): """ :keyword recovery_point_id: ID of the backup copy to be recovered. :paramtype recovery_point_id: str - :keyword recovery_type: Type of this recovery. Possible values include: "Invalid", - "OriginalLocation", "AlternateLocation", "RestoreDisks", "Offline". + :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", + "AlternateLocation", "RestoreDisks", and "Offline". :paramtype recovery_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryType :keyword source_resource_id: Fully qualified ARM ID of the VM which is being recovered. @@ -7061,8 +7376,8 @@ def __init__( :paramtype identity_based_restore_details: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.IdentityBasedRestoreDetails """ - super(IaasVMRestoreRequest, self).__init__(**kwargs) - self.object_type = 'IaasVMRestoreRequest' # type: str + super().__init__(**kwargs) + self.object_type = "IaasVMRestoreRequest" # type: str self.recovery_point_id = recovery_point_id self.recovery_type = recovery_type self.source_resource_id = source_resource_id @@ -7085,7 +7400,7 @@ def __init__( self.identity_based_restore_details = identity_based_restore_details -class IdentityBasedRestoreDetails(msrest.serialization.Model): +class IdentityBasedRestoreDetails(_serialization.Model): """IaaS VM workload specific restore details for restores using managed identity. :ivar object_type: Gets the class type. @@ -7095,29 +7410,23 @@ class IdentityBasedRestoreDetails(msrest.serialization.Model): """ _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'target_storage_account_id': {'key': 'targetStorageAccountId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "target_storage_account_id": {"key": "targetStorageAccountId", "type": "str"}, } - def __init__( - self, - *, - object_type: Optional[str] = None, - target_storage_account_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, object_type: Optional[str] = None, target_storage_account_id: Optional[str] = None, **kwargs): """ :keyword object_type: Gets the class type. :paramtype object_type: str :keyword target_storage_account_id: Fully qualified ARM ID of the target storage account. :paramtype target_storage_account_id: str """ - super(IdentityBasedRestoreDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.object_type = object_type self.target_storage_account_id = target_storage_account_id -class IdentityInfo(msrest.serialization.Model): +class IdentityInfo(_serialization.Model): """Encapsulates Managed Identity related information. :ivar is_system_assigned_identity: To differentiate if the managed identity is system assigned @@ -7129,8 +7438,8 @@ class IdentityInfo(msrest.serialization.Model): """ _attribute_map = { - 'is_system_assigned_identity': {'key': 'isSystemAssignedIdentity', 'type': 'bool'}, - 'managed_identity_resource_id': {'key': 'managedIdentityResourceId', 'type': 'str'}, + "is_system_assigned_identity": {"key": "isSystemAssignedIdentity", "type": "bool"}, + "managed_identity_resource_id": {"key": "managedIdentityResourceId", "type": "str"}, } def __init__( @@ -7148,12 +7457,12 @@ def __init__( Optional: Might not be required in the case of system assigned managed identity. :paramtype managed_identity_resource_id: str """ - super(IdentityInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_system_assigned_identity = is_system_assigned_identity self.managed_identity_resource_id = managed_identity_resource_id -class InstantItemRecoveryTarget(msrest.serialization.Model): +class InstantItemRecoveryTarget(_serialization.Model): """Target details for file / folder restore. :ivar client_scripts: List of client scripts. @@ -7162,38 +7471,33 @@ class InstantItemRecoveryTarget(msrest.serialization.Model): """ _attribute_map = { - 'client_scripts': {'key': 'clientScripts', 'type': '[ClientScriptForConnect]'}, + "client_scripts": {"key": "clientScripts", "type": "[ClientScriptForConnect]"}, } - def __init__( - self, - *, - client_scripts: Optional[List["ClientScriptForConnect"]] = None, - **kwargs - ): + def __init__(self, *, client_scripts: Optional[List["_models.ClientScriptForConnect"]] = None, **kwargs): """ :keyword client_scripts: List of client scripts. :paramtype client_scripts: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ClientScriptForConnect] """ - super(InstantItemRecoveryTarget, self).__init__(**kwargs) + super().__init__(**kwargs) self.client_scripts = client_scripts -class JobQueryObject(msrest.serialization.Model): +class JobQueryObject(_serialization.Model): """Filters to list the jobs. - :ivar status: Status of the job. Possible values include: "Invalid", "InProgress", "Completed", - "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + :ivar status: Status of the job. Known values are: "Invalid", "InProgress", "Completed", + "Failed", "CompletedWithWarnings", "Cancelled", and "Cancelling". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobStatus - :ivar backup_management_type: Type of backup management for the job. Possible values include: + :ivar backup_management_type: Type of backup management for the job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar operation: Type of operation. Possible values include: "Invalid", "Register", - "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + :ivar operation: Type of operation. Known values are: "Invalid", "Register", "UnRegister", + "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :vartype operation: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobOperationType :ivar job_id: JobID represents the job uniquely. @@ -7205,37 +7509,37 @@ class JobQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + "status": {"key": "status", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, } def __init__( self, *, - status: Optional[Union[str, "JobStatus"]] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - operation: Optional[Union[str, "JobOperationType"]] = None, + status: Optional[Union[str, "_models.JobStatus"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + operation: Optional[Union[str, "_models.JobOperationType"]] = None, job_id: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, **kwargs ): """ - :keyword status: Status of the job. Possible values include: "Invalid", "InProgress", - "Completed", "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + :keyword status: Status of the job. Known values are: "Invalid", "InProgress", "Completed", + "Failed", "CompletedWithWarnings", "Cancelled", and "Cancelling". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobStatus - :keyword backup_management_type: Type of backup management for the job. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the job. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword operation: Type of operation. Possible values include: "Invalid", "Register", - "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + :keyword operation: Type of operation. Known values are: "Invalid", "Register", "UnRegister", + "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :paramtype operation: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobOperationType :keyword job_id: JobID represents the job uniquely. @@ -7245,7 +7549,7 @@ def __init__( :keyword end_time: Job has ended at this time. Value is in UTC. :paramtype end_time: ~datetime.datetime """ - super(JobQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.status = status self.backup_management_type = backup_management_type self.operation = operation @@ -7268,7 +7572,7 @@ class JobResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -7277,19 +7581,19 @@ class JobResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'Job'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "Job"}, } def __init__( @@ -7298,24 +7602,24 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["Job"] = None, + properties: Optional["_models.Job"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: JobResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.Job """ - super(JobResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties -class ResourceList(msrest.serialization.Model): +class ResourceList(_serialization.Model): """Base for all lists of resources. :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page @@ -7324,21 +7628,16 @@ class ResourceList(msrest.serialization.Model): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): + def __init__(self, *, next_link: Optional[str] = None, **kwargs): """ :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. :paramtype next_link: str """ - super(ResourceList, self).__init__(**kwargs) + super().__init__(**kwargs) self.next_link = next_link @@ -7353,16 +7652,12 @@ class JobResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[JobResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[JobResource]"}, } def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["JobResource"]] = None, - **kwargs + self, *, next_link: Optional[str] = None, value: Optional[List["_models.JobResource"]] = None, **kwargs ): """ :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next @@ -7371,11 +7666,11 @@ def __init__( :keyword value: List of resources. :paramtype value: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] """ - super(JobResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class KEKDetails(msrest.serialization.Model): +class KEKDetails(_serialization.Model): """KEK is encryption key for BEK. :ivar key_url: Key is KEK. @@ -7387,9 +7682,9 @@ class KEKDetails(msrest.serialization.Model): """ _attribute_map = { - 'key_url': {'key': 'keyUrl', 'type': 'str'}, - 'key_vault_id': {'key': 'keyVaultId', 'type': 'str'}, - 'key_backup_data': {'key': 'keyBackupData', 'type': 'str'}, + "key_url": {"key": "keyUrl", "type": "str"}, + "key_vault_id": {"key": "keyVaultId", "type": "str"}, + "key_backup_data": {"key": "keyBackupData", "type": "str"}, } def __init__( @@ -7408,42 +7703,42 @@ def __init__( :keyword key_backup_data: KEK data. :paramtype key_backup_data: str """ - super(KEKDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.key_url = key_url self.key_vault_id = key_vault_id self.key_backup_data = key_backup_data -class KeyAndSecretDetails(msrest.serialization.Model): +class KeyAndSecretDetails(_serialization.Model): """BEK is bitlocker key. -KEK is encryption key for BEK -If the VM was encrypted then we will store following details : + KEK is encryption key for BEK + If the VM was encrypted then we will store following details : -#. Secret(BEK) - Url + Backup Data + vaultId. -#. Key(KEK) - Url + Backup Data + vaultId. -#. EncryptionMechanism - BEK and KEK can potentially have different vault ids. + #. Secret(BEK) - Url + Backup Data + vaultId. + #. Key(KEK) - Url + Backup Data + vaultId. + #. EncryptionMechanism + BEK and KEK can potentially have different vault ids. - :ivar kek_details: KEK is encryption key for BEK. - :vartype kek_details: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.KEKDetails - :ivar bek_details: BEK is bitlocker encryption key. - :vartype bek_details: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BEKDetails - :ivar encryption_mechanism: Encryption mechanism: None/ SinglePass/ DoublePass. - :vartype encryption_mechanism: str + :ivar kek_details: KEK is encryption key for BEK. + :vartype kek_details: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.KEKDetails + :ivar bek_details: BEK is bitlocker encryption key. + :vartype bek_details: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BEKDetails + :ivar encryption_mechanism: Encryption mechanism: None/ SinglePass/ DoublePass. + :vartype encryption_mechanism: str """ _attribute_map = { - 'kek_details': {'key': 'kekDetails', 'type': 'KEKDetails'}, - 'bek_details': {'key': 'bekDetails', 'type': 'BEKDetails'}, - 'encryption_mechanism': {'key': 'encryptionMechanism', 'type': 'str'}, + "kek_details": {"key": "kekDetails", "type": "KEKDetails"}, + "bek_details": {"key": "bekDetails", "type": "BEKDetails"}, + "encryption_mechanism": {"key": "encryptionMechanism", "type": "str"}, } def __init__( self, *, - kek_details: Optional["KEKDetails"] = None, - bek_details: Optional["BEKDetails"] = None, + kek_details: Optional["_models.KEKDetails"] = None, + bek_details: Optional["_models.BEKDetails"] = None, encryption_mechanism: Optional[str] = None, **kwargs ): @@ -7455,17 +7750,17 @@ def __init__( :keyword encryption_mechanism: Encryption mechanism: None/ SinglePass/ DoublePass. :paramtype encryption_mechanism: str """ - super(KeyAndSecretDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.kek_details = kek_details self.bek_details = bek_details self.encryption_mechanism = encryption_mechanism -class KPIResourceHealthDetails(msrest.serialization.Model): +class KPIResourceHealthDetails(_serialization.Model): """KPI Resource Health Details. - :ivar resource_health_status: Resource Health Status. Possible values include: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + :ivar resource_health_status: Resource Health Status. Known values are: "Healthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :vartype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ResourceHealthStatus @@ -7475,20 +7770,20 @@ class KPIResourceHealthDetails(msrest.serialization.Model): """ _attribute_map = { - 'resource_health_status': {'key': 'resourceHealthStatus', 'type': 'str'}, - 'resource_health_details': {'key': 'resourceHealthDetails', 'type': '[ResourceHealthDetails]'}, + "resource_health_status": {"key": "resourceHealthStatus", "type": "str"}, + "resource_health_details": {"key": "resourceHealthDetails", "type": "[ResourceHealthDetails]"}, } def __init__( self, *, - resource_health_status: Optional[Union[str, "ResourceHealthStatus"]] = None, - resource_health_details: Optional[List["ResourceHealthDetails"]] = None, + resource_health_status: Optional[Union[str, "_models.ResourceHealthStatus"]] = None, + resource_health_details: Optional[List["_models.ResourceHealthDetails"]] = None, **kwargs ): """ - :keyword resource_health_status: Resource Health Status. Possible values include: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + :keyword resource_health_status: Resource Health Status. Known values are: "Healthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :paramtype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ResourceHealthStatus @@ -7496,12 +7791,12 @@ def __init__( :paramtype resource_health_details: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ResourceHealthDetails] """ - super(KPIResourceHealthDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.resource_health_status = resource_health_status self.resource_health_details = resource_health_details -class MabErrorInfo(msrest.serialization.Model): +class MabErrorInfo(_serialization.Model): """MAB workload-specific error information. Variables are only populated by the server, and will be ignored when sending a request. @@ -7513,41 +7808,37 @@ class MabErrorInfo(msrest.serialization.Model): """ _validation = { - 'error_string': {'readonly': True}, - 'recommendations': {'readonly': True}, + "error_string": {"readonly": True}, + "recommendations": {"readonly": True}, } _attribute_map = { - 'error_string': {'key': 'errorString', 'type': 'str'}, - 'recommendations': {'key': 'recommendations', 'type': '[str]'}, + "error_string": {"key": "errorString", "type": "str"}, + "recommendations": {"key": "recommendations", "type": "[str]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(MabErrorInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.error_string = None self.recommendations = None -class MabFileFolderProtectedItem(ProtectedItem): +class MabFileFolderProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes """MAB workload-specific backup item. All required parameters must be populated in order to send to Azure. - :ivar protected_item_type: Required. backup item type.Constant filled by server. + :ivar protected_item_type: backup item type. Required. :vartype protected_item_type: str - :ivar backup_management_type: Type of backup management for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar workload_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar workload_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -7563,7 +7854,7 @@ class MabFileFolderProtectedItem(ProtectedItem): :ivar backup_set_name: Name of the backup set the backup item belongs to. :vartype backup_set_name: str :ivar create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :vartype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :ivar deferred_delete_time_in_utc: Time for deferred deletion in UTC. :vartype deferred_delete_time_in_utc: ~datetime.datetime @@ -7592,52 +7883,52 @@ class MabFileFolderProtectedItem(ProtectedItem): :ivar protection_state: Protected, ProtectionStopped, IRPending or ProtectionError. :vartype protection_state: str :ivar deferred_delete_sync_time_in_utc: Sync time for deferred deletion in UTC. - :vartype deferred_delete_sync_time_in_utc: long + :vartype deferred_delete_sync_time_in_utc: int :ivar extended_info: Additional information with this backup item. :vartype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabFileFolderProtectedItemExtendedInfo """ _validation = { - 'protected_item_type': {'required': True}, + "protected_item_type": {"required": True}, } _attribute_map = { - 'protected_item_type': {'key': 'protectedItemType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - 'last_recovery_point': {'key': 'lastRecoveryPoint', 'type': 'iso-8601'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'deferred_delete_time_in_utc': {'key': 'deferredDeleteTimeInUTC', 'type': 'iso-8601'}, - 'is_scheduled_for_deferred_delete': {'key': 'isScheduledForDeferredDelete', 'type': 'bool'}, - 'deferred_delete_time_remaining': {'key': 'deferredDeleteTimeRemaining', 'type': 'str'}, - 'is_deferred_delete_schedule_upcoming': {'key': 'isDeferredDeleteScheduleUpcoming', 'type': 'bool'}, - 'is_rehydrate': {'key': 'isRehydrate', 'type': 'bool'}, - 'resource_guard_operation_requests': {'key': 'resourceGuardOperationRequests', 'type': '[str]'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'computer_name': {'key': 'computerName', 'type': 'str'}, - 'last_backup_status': {'key': 'lastBackupStatus', 'type': 'str'}, - 'last_backup_time': {'key': 'lastBackupTime', 'type': 'iso-8601'}, - 'protection_state': {'key': 'protectionState', 'type': 'str'}, - 'deferred_delete_sync_time_in_utc': {'key': 'deferredDeleteSyncTimeInUTC', 'type': 'long'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'MabFileFolderProtectedItemExtendedInfo'}, + "protected_item_type": {"key": "protectedItemType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "source_resource_id": {"key": "sourceResourceId", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + "last_recovery_point": {"key": "lastRecoveryPoint", "type": "iso-8601"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, + "create_mode": {"key": "createMode", "type": "str"}, + "deferred_delete_time_in_utc": {"key": "deferredDeleteTimeInUTC", "type": "iso-8601"}, + "is_scheduled_for_deferred_delete": {"key": "isScheduledForDeferredDelete", "type": "bool"}, + "deferred_delete_time_remaining": {"key": "deferredDeleteTimeRemaining", "type": "str"}, + "is_deferred_delete_schedule_upcoming": {"key": "isDeferredDeleteScheduleUpcoming", "type": "bool"}, + "is_rehydrate": {"key": "isRehydrate", "type": "bool"}, + "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "computer_name": {"key": "computerName", "type": "str"}, + "last_backup_status": {"key": "lastBackupStatus", "type": "str"}, + "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "deferred_delete_sync_time_in_utc": {"key": "deferredDeleteSyncTimeInUTC", "type": "int"}, + "extended_info": {"key": "extendedInfo", "type": "MabFileFolderProtectedItemExtendedInfo"}, } def __init__( self, *, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - workload_type: Optional[Union[str, "DataSourceType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + workload_type: Optional[Union[str, "_models.DataSourceType"]] = None, container_name: Optional[str] = None, source_resource_id: Optional[str] = None, policy_id: Optional[str] = None, last_recovery_point: Optional[datetime.datetime] = None, backup_set_name: Optional[str] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, deferred_delete_time_in_utc: Optional[datetime.datetime] = None, is_scheduled_for_deferred_delete: Optional[bool] = None, deferred_delete_time_remaining: Optional[str] = None, @@ -7650,19 +7941,19 @@ def __init__( last_backup_time: Optional[datetime.datetime] = None, protection_state: Optional[str] = None, deferred_delete_sync_time_in_utc: Optional[int] = None, - extended_info: Optional["MabFileFolderProtectedItemExtendedInfo"] = None, + extended_info: Optional["_models.MabFileFolderProtectedItemExtendedInfo"] = None, **kwargs ): """ - :keyword backup_management_type: Type of backup management for the backed up item. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Type of backup management for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword workload_type: Type of workload this item represents. Possible values include: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase". + :keyword workload_type: Type of workload this item represents. Known values are: "Invalid", + "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and + "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType :keyword container_name: Unique name of container. @@ -7677,7 +7968,7 @@ def __init__( :keyword backup_set_name: Name of the backup set the backup item belongs to. :paramtype backup_set_name: str :keyword create_mode: Create mode to indicate recovery of existing soft deleted data source or - creation of new data source. Possible values include: "Invalid", "Default", "Recover". + creation of new data source. Known values are: "Invalid", "Default", and "Recover". :paramtype create_mode: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CreateMode :keyword deferred_delete_time_in_utc: Time for deferred deletion in UTC. @@ -7708,13 +7999,29 @@ def __init__( :keyword protection_state: Protected, ProtectionStopped, IRPending or ProtectionError. :paramtype protection_state: str :keyword deferred_delete_sync_time_in_utc: Sync time for deferred deletion in UTC. - :paramtype deferred_delete_sync_time_in_utc: long + :paramtype deferred_delete_sync_time_in_utc: int :keyword extended_info: Additional information with this backup item. :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabFileFolderProtectedItemExtendedInfo """ - super(MabFileFolderProtectedItem, self).__init__(backup_management_type=backup_management_type, workload_type=workload_type, container_name=container_name, source_resource_id=source_resource_id, policy_id=policy_id, last_recovery_point=last_recovery_point, backup_set_name=backup_set_name, create_mode=create_mode, deferred_delete_time_in_utc=deferred_delete_time_in_utc, is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, deferred_delete_time_remaining=deferred_delete_time_remaining, is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, is_rehydrate=is_rehydrate, resource_guard_operation_requests=resource_guard_operation_requests, **kwargs) - self.protected_item_type = 'MabFileFolderProtectedItem' # type: str + super().__init__( + backup_management_type=backup_management_type, + workload_type=workload_type, + container_name=container_name, + source_resource_id=source_resource_id, + policy_id=policy_id, + last_recovery_point=last_recovery_point, + backup_set_name=backup_set_name, + create_mode=create_mode, + deferred_delete_time_in_utc=deferred_delete_time_in_utc, + is_scheduled_for_deferred_delete=is_scheduled_for_deferred_delete, + deferred_delete_time_remaining=deferred_delete_time_remaining, + is_deferred_delete_schedule_upcoming=is_deferred_delete_schedule_upcoming, + is_rehydrate=is_rehydrate, + resource_guard_operation_requests=resource_guard_operation_requests, + **kwargs + ) + self.protected_item_type = "MabFileFolderProtectedItem" # type: str self.friendly_name = friendly_name self.computer_name = computer_name self.last_backup_status = last_backup_status @@ -7724,7 +8031,7 @@ def __init__( self.extended_info = extended_info -class MabFileFolderProtectedItemExtendedInfo(msrest.serialization.Model): +class MabFileFolderProtectedItemExtendedInfo(_serialization.Model): """Additional information on the backed up item. :ivar last_refreshed_at: Last time when the agent data synced to service. @@ -7736,9 +8043,9 @@ class MabFileFolderProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'last_refreshed_at': {'key': 'lastRefreshedAt', 'type': 'iso-8601'}, - 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, - 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, + "last_refreshed_at": {"key": "lastRefreshedAt", "type": "iso-8601"}, + "oldest_recovery_point": {"key": "oldestRecoveryPoint", "type": "iso-8601"}, + "recovery_point_count": {"key": "recoveryPointCount", "type": "int"}, } def __init__( @@ -7757,22 +8064,22 @@ def __init__( :keyword recovery_point_count: Number of backup copies associated with the backup item. :paramtype recovery_point_count: int """ - super(MabFileFolderProtectedItemExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.last_refreshed_at = last_refreshed_at self.oldest_recovery_point = oldest_recovery_point self.recovery_point_count = recovery_point_count -class MabJob(Job): +class MabJob(Job): # pylint: disable=too-many-instance-attributes """MAB workload-specific job. All required parameters must be populated in order to send to Azure. :ivar entity_friendly_name: Friendly name of the entity on which the current job is executing. :vartype entity_friendly_name: str - :ivar backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type to execute the current job. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :ivar operation: The operation name. @@ -7785,8 +8092,8 @@ class MabJob(Job): :vartype end_time: ~datetime.datetime :ivar activity_id: ActivityId of job. :vartype activity_id: str - :ivar job_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. + :ivar job_type: This property will be used as the discriminator for deciding the specific types + in the polymorphic chain of types. Required. :vartype job_type: str :ivar duration: Time taken by job to run. :vartype duration: ~datetime.timedelta @@ -7795,15 +8102,15 @@ class MabJob(Job): ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobSupportedAction] :ivar mab_server_name: Name of server protecting the DS. :vartype mab_server_name: str - :ivar mab_server_type: Server type of MAB container. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer". + :ivar mab_server_type: Server type of MAB container. Known values are: "Invalid", "Unknown", + "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", + "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :vartype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabServerType - :ivar workload_type: Workload type of backup item. Possible values include: "Invalid", "VM", + :ivar workload_type: Workload type of backup item. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.WorkloadType @@ -7816,53 +8123,53 @@ class MabJob(Job): """ _validation = { - 'job_type': {'required': True}, + "job_type": {"required": True}, } _attribute_map = { - 'entity_friendly_name': {'key': 'entityFriendlyName', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - 'job_type': {'key': 'jobType', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'actions_info': {'key': 'actionsInfo', 'type': '[str]'}, - 'mab_server_name': {'key': 'mabServerName', 'type': 'str'}, - 'mab_server_type': {'key': 'mabServerType', 'type': 'str'}, - 'workload_type': {'key': 'workloadType', 'type': 'str'}, - 'error_details': {'key': 'errorDetails', 'type': '[MabErrorInfo]'}, - 'extended_info': {'key': 'extendedInfo', 'type': 'MabJobExtendedInfo'}, + "entity_friendly_name": {"key": "entityFriendlyName", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "activity_id": {"key": "activityId", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "duration": {"key": "duration", "type": "duration"}, + "actions_info": {"key": "actionsInfo", "type": "[str]"}, + "mab_server_name": {"key": "mabServerName", "type": "str"}, + "mab_server_type": {"key": "mabServerType", "type": "str"}, + "workload_type": {"key": "workloadType", "type": "str"}, + "error_details": {"key": "errorDetails", "type": "[MabErrorInfo]"}, + "extended_info": {"key": "extendedInfo", "type": "MabJobExtendedInfo"}, } def __init__( self, *, entity_friendly_name: Optional[str] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, operation: Optional[str] = None, status: Optional[str] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, activity_id: Optional[str] = None, duration: Optional[datetime.timedelta] = None, - actions_info: Optional[List[Union[str, "JobSupportedAction"]]] = None, + actions_info: Optional[List[Union[str, "_models.JobSupportedAction"]]] = None, mab_server_name: Optional[str] = None, - mab_server_type: Optional[Union[str, "MabServerType"]] = None, - workload_type: Optional[Union[str, "WorkloadType"]] = None, - error_details: Optional[List["MabErrorInfo"]] = None, - extended_info: Optional["MabJobExtendedInfo"] = None, + mab_server_type: Optional[Union[str, "_models.MabServerType"]] = None, + workload_type: Optional[Union[str, "_models.WorkloadType"]] = None, + error_details: Optional[List["_models.MabErrorInfo"]] = None, + extended_info: Optional["_models.MabJobExtendedInfo"] = None, **kwargs ): """ :keyword entity_friendly_name: Friendly name of the entity on which the current job is executing. :paramtype entity_friendly_name: str - :keyword backup_management_type: Backup management type to execute the current job. Possible - values include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type to execute the current job. Known + values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -7882,15 +8189,15 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobSupportedAction] :keyword mab_server_name: Name of server protecting the DS. :paramtype mab_server_name: str - :keyword mab_server_type: Server type of MAB container. Possible values include: "Invalid", - "Unknown", "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", - "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", "Windows", - "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer". + :keyword mab_server_type: Server type of MAB container. Known values are: "Invalid", "Unknown", + "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", + "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :paramtype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabServerType - :keyword workload_type: Workload type of backup item. Possible values include: "Invalid", "VM", + :keyword workload_type: Workload type of backup item. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.WorkloadType @@ -7901,8 +8208,17 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabJobExtendedInfo """ - super(MabJob, self).__init__(entity_friendly_name=entity_friendly_name, backup_management_type=backup_management_type, operation=operation, status=status, start_time=start_time, end_time=end_time, activity_id=activity_id, **kwargs) - self.job_type = 'MabJob' # type: str + super().__init__( + entity_friendly_name=entity_friendly_name, + backup_management_type=backup_management_type, + operation=operation, + status=status, + start_time=start_time, + end_time=end_time, + activity_id=activity_id, + **kwargs + ) + self.job_type = "MabJob" # type: str self.duration = duration self.actions_info = actions_info self.mab_server_name = mab_server_name @@ -7912,7 +8228,7 @@ def __init__( self.extended_info = extended_info -class MabJobExtendedInfo(msrest.serialization.Model): +class MabJobExtendedInfo(_serialization.Model): """Additional information for the MAB workload-specific job. :ivar tasks_list: List of tasks for this job. @@ -7925,15 +8241,15 @@ class MabJobExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - 'tasks_list': {'key': 'tasksList', 'type': '[MabJobTaskDetails]'}, - 'property_bag': {'key': 'propertyBag', 'type': '{str}'}, - 'dynamic_error_message': {'key': 'dynamicErrorMessage', 'type': 'str'}, + "tasks_list": {"key": "tasksList", "type": "[MabJobTaskDetails]"}, + "property_bag": {"key": "propertyBag", "type": "{str}"}, + "dynamic_error_message": {"key": "dynamicErrorMessage", "type": "str"}, } def __init__( self, *, - tasks_list: Optional[List["MabJobTaskDetails"]] = None, + tasks_list: Optional[List["_models.MabJobTaskDetails"]] = None, property_bag: Optional[Dict[str, str]] = None, dynamic_error_message: Optional[str] = None, **kwargs @@ -7947,13 +8263,13 @@ def __init__( :keyword dynamic_error_message: Non localized error message specific to this job. :paramtype dynamic_error_message: str """ - super(MabJobExtendedInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.tasks_list = tasks_list self.property_bag = property_bag self.dynamic_error_message = dynamic_error_message -class MabJobTaskDetails(msrest.serialization.Model): +class MabJobTaskDetails(_serialization.Model): """MAB workload-specific job task details. :ivar task_id: The task display name. @@ -7969,11 +8285,11 @@ class MabJobTaskDetails(msrest.serialization.Model): """ _attribute_map = { - 'task_id': {'key': 'taskId', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'duration': {'key': 'duration', 'type': 'duration'}, - 'status': {'key': 'status', 'type': 'str'}, + "task_id": {"key": "taskId", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "duration": {"key": "duration", "type": "duration"}, + "status": {"key": "status", "type": "str"}, } def __init__( @@ -7998,7 +8314,7 @@ def __init__( :keyword status: The status. :paramtype status: str """ - super(MabJobTaskDetails, self).__init__(**kwargs) + super().__init__(**kwargs) self.task_id = task_id self.start_time = start_time self.end_time = end_time @@ -8006,7 +8322,7 @@ def __init__( self.status = status -class NameInfo(msrest.serialization.Model): +class NameInfo(_serialization.Model): """The name of usage. :ivar value: Value of usage. @@ -8016,29 +8332,23 @@ class NameInfo(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__( - self, - *, - value: Optional[str] = None, - localized_value: Optional[str] = None, - **kwargs - ): + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): """ :keyword value: Value of usage. :paramtype value: str :keyword localized_value: Localized value of usage. :paramtype localized_value: str """ - super(NameInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.value = value self.localized_value = localized_value -class NewErrorResponse(msrest.serialization.Model): +class NewErrorResponse(_serialization.Model): """The resource management error response. :ivar error: The error object. @@ -8046,24 +8356,19 @@ class NewErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'NewErrorResponseError'}, + "error": {"key": "error", "type": "NewErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["NewErrorResponseError"] = None, - **kwargs - ): + def __init__(self, *, error: Optional["_models.NewErrorResponseError"] = None, **kwargs): """ :keyword error: The error object. :paramtype error: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.NewErrorResponseError """ - super(NewErrorResponse, self).__init__(**kwargs) + super().__init__(**kwargs) self.error = error -class NewErrorResponseError(msrest.serialization.Model): +class NewErrorResponseError(_serialization.Model): """The error object. Variables are only populated by the server, and will be ignored when sending a request. @@ -8082,28 +8387,24 @@ class NewErrorResponseError(msrest.serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[NewErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[NewErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ - super(NewErrorResponseError, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.code = None self.message = None self.target = None @@ -8111,15 +8412,15 @@ def __init__( self.additional_info = None -class OperationStatus(msrest.serialization.Model): +class OperationStatus(_serialization.Model): """Operation status. :ivar id: ID of the operation. :vartype id: str :ivar name: Name of the operation. :vartype name: str - :ivar status: Operation status. Possible values include: "Invalid", "InProgress", "Succeeded", - "Failed", "Canceled". + :ivar status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", + "Failed", and "Canceled". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatusValues :ivar start_time: Operation start time. Format: ISO-8601. @@ -8134,25 +8435,25 @@ class OperationStatus(msrest.serialization.Model): """ _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'OperationStatusError'}, - 'properties': {'key': 'properties', 'type': 'OperationStatusExtendedInfo'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "error": {"key": "error", "type": "OperationStatusError"}, + "properties": {"key": "properties", "type": "OperationStatusExtendedInfo"}, } def __init__( self, *, - id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, - status: Optional[Union[str, "OperationStatusValues"]] = None, + status: Optional[Union[str, "_models.OperationStatusValues"]] = None, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, - error: Optional["OperationStatusError"] = None, - properties: Optional["OperationStatusExtendedInfo"] = None, + error: Optional["_models.OperationStatusError"] = None, + properties: Optional["_models.OperationStatusExtendedInfo"] = None, **kwargs ): """ @@ -8160,8 +8461,8 @@ def __init__( :paramtype id: str :keyword name: Name of the operation. :paramtype name: str - :keyword status: Operation status. Possible values include: "Invalid", "InProgress", - "Succeeded", "Failed", "Canceled". + :keyword status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", + "Failed", and "Canceled". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatusValues :keyword start_time: Operation start time. Format: ISO-8601. @@ -8174,7 +8475,7 @@ def __init__( :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatusExtendedInfo """ - super(OperationStatus, self).__init__(**kwargs) + super().__init__(**kwargs) self.id = id self.name = name self.status = status @@ -8184,7 +8485,7 @@ def __init__( self.properties = properties -class OperationStatusError(msrest.serialization.Model): +class OperationStatusError(_serialization.Model): """Error information associated with operation status call. :ivar code: Error code of the operation failure. @@ -8194,60 +8495,56 @@ class OperationStatusError(msrest.serialization.Model): """ _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, } - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs): """ :keyword code: Error code of the operation failure. :paramtype code: str :keyword message: Error message displayed if the operation failure. :paramtype message: str """ - super(OperationStatusError, self).__init__(**kwargs) + super().__init__(**kwargs) self.code = code self.message = message -class OperationStatusExtendedInfo(msrest.serialization.Model): +class OperationStatusExtendedInfo(_serialization.Model): """Base class for additional information of operation status. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: OperationStatusJobExtendedInfo, OperationStatusJobsExtendedInfo, OperationStatusProvisionILRExtendedInfo, OperationStatusRecoveryPointExtendedInfo. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OperationStatusJobExtendedInfo, OperationStatusJobsExtendedInfo, + OperationStatusProvisionILRExtendedInfo, OperationStatusRecoveryPointExtendedInfo All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, } _subtype_map = { - 'object_type': {'OperationStatusJobExtendedInfo': 'OperationStatusJobExtendedInfo', 'OperationStatusJobsExtendedInfo': 'OperationStatusJobsExtendedInfo', 'OperationStatusProvisionILRExtendedInfo': 'OperationStatusProvisionILRExtendedInfo', 'OperationStatusRecoveryPointExtendedInfo': 'OperationStatusRecoveryPointExtendedInfo'} + "object_type": { + "OperationStatusJobExtendedInfo": "OperationStatusJobExtendedInfo", + "OperationStatusJobsExtendedInfo": "OperationStatusJobsExtendedInfo", + "OperationStatusProvisionILRExtendedInfo": "OperationStatusProvisionILRExtendedInfo", + "OperationStatusRecoveryPointExtendedInfo": "OperationStatusRecoveryPointExtendedInfo", + } } - def __init__( - self, - **kwargs - ): - """ - """ - super(OperationStatusExtendedInfo, self).__init__(**kwargs) + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) self.object_type = None # type: Optional[str] @@ -8256,34 +8553,29 @@ class OperationStatusJobExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar job_id: ID of the job created for this protected item. :vartype job_id: str """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'job_id': {'key': 'jobId', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, } - def __init__( - self, - *, - job_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, job_id: Optional[str] = None, **kwargs): """ :keyword job_id: ID of the job created for this protected item. :paramtype job_id: str """ - super(OperationStatusJobExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusJobExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusJobExtendedInfo" # type: str self.job_id = job_id @@ -8292,8 +8584,8 @@ class OperationStatusJobsExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar job_ids: IDs of the jobs created for the protected item. :vartype job_ids: list[str] @@ -8302,21 +8594,17 @@ class OperationStatusJobsExtendedInfo(OperationStatusExtendedInfo): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'job_ids': {'key': 'jobIds', 'type': '[str]'}, - 'failed_jobs_error': {'key': 'failedJobsError', 'type': '{str}'}, + "object_type": {"key": "objectType", "type": "str"}, + "job_ids": {"key": "jobIds", "type": "[str]"}, + "failed_jobs_error": {"key": "failedJobsError", "type": "{str}"}, } def __init__( - self, - *, - job_ids: Optional[List[str]] = None, - failed_jobs_error: Optional[Dict[str, str]] = None, - **kwargs + self, *, job_ids: Optional[List[str]] = None, failed_jobs_error: Optional[Dict[str, str]] = None, **kwargs ): """ :keyword job_ids: IDs of the jobs created for the protected item. @@ -8325,8 +8613,8 @@ def __init__( codes. :paramtype failed_jobs_error: dict[str, str] """ - super(OperationStatusJobsExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusJobsExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusJobsExtendedInfo" # type: str self.job_ids = job_ids self.failed_jobs_error = failed_jobs_error @@ -8336,8 +8624,8 @@ class OperationStatusProvisionILRExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar recovery_target: Target details for file / folder restore. :vartype recovery_target: @@ -8345,27 +8633,22 @@ class OperationStatusProvisionILRExtendedInfo(OperationStatusExtendedInfo): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'recovery_target': {'key': 'recoveryTarget', 'type': 'InstantItemRecoveryTarget'}, + "object_type": {"key": "objectType", "type": "str"}, + "recovery_target": {"key": "recoveryTarget", "type": "InstantItemRecoveryTarget"}, } - def __init__( - self, - *, - recovery_target: Optional["InstantItemRecoveryTarget"] = None, - **kwargs - ): + def __init__(self, *, recovery_target: Optional["_models.InstantItemRecoveryTarget"] = None, **kwargs): """ :keyword recovery_target: Target details for file / folder restore. :paramtype recovery_target: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.InstantItemRecoveryTarget """ - super(OperationStatusProvisionILRExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusProvisionILRExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusProvisionILRExtendedInfo" # type: str self.recovery_target = recovery_target @@ -8374,8 +8657,8 @@ class OperationStatusRecoveryPointExtendedInfo(OperationStatusExtendedInfo): All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. :vartype object_type: str :ivar updated_recovery_point: Recovery Point info with updated source snapshot URI. :vartype updated_recovery_point: @@ -8386,19 +8669,19 @@ class OperationStatusRecoveryPointExtendedInfo(OperationStatusExtendedInfo): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'updated_recovery_point': {'key': 'updatedRecoveryPoint', 'type': 'RecoveryPoint'}, - 'deleted_backup_item_version': {'key': 'deletedBackupItemVersion', 'type': 'str'}, + "object_type": {"key": "objectType", "type": "str"}, + "updated_recovery_point": {"key": "updatedRecoveryPoint", "type": "RecoveryPoint"}, + "deleted_backup_item_version": {"key": "deletedBackupItemVersion", "type": "str"}, } def __init__( self, *, - updated_recovery_point: Optional["RecoveryPoint"] = None, + updated_recovery_point: Optional["_models.RecoveryPoint"] = None, deleted_backup_item_version: Optional[str] = None, **kwargs ): @@ -8410,13 +8693,13 @@ def __init__( field with deleted backup item. :paramtype deleted_backup_item_version: str """ - super(OperationStatusRecoveryPointExtendedInfo, self).__init__(**kwargs) - self.object_type = 'OperationStatusRecoveryPointExtendedInfo' # type: str + super().__init__(**kwargs) + self.object_type = "OperationStatusRecoveryPointExtendedInfo" # type: str self.updated_recovery_point = updated_recovery_point self.deleted_backup_item_version = deleted_backup_item_version -class PointInTimeRange(msrest.serialization.Model): +class PointInTimeRange(_serialization.Model): """Provides details for log ranges. :ivar start_time: Start time of the time range for log recovery. @@ -8426,16 +8709,12 @@ class PointInTimeRange(msrest.serialization.Model): """ _attribute_map = { - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, } def __init__( - self, - *, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - **kwargs + self, *, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None, **kwargs ): """ :keyword start_time: Start time of the time range for log recovery. @@ -8443,26 +8722,26 @@ def __init__( :keyword end_time: End time of the time range for log recovery. :paramtype end_time: ~datetime.datetime """ - super(PointInTimeRange, self).__init__(**kwargs) + super().__init__(**kwargs) self.start_time = start_time self.end_time = end_time -class ProtectedItemQueryObject(msrest.serialization.Model): +class ProtectedItemQueryObject(_serialization.Model): """Filters to list backup items. - :ivar health_state: Health State for the backed up item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :ivar health_state: Health State for the backed up item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthState - :ivar backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :ivar backup_management_type: Backup management type for the backed up item. Known values are: + "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :vartype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :ivar item_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :ivar item_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype item_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -8481,23 +8760,23 @@ class ProtectedItemQueryObject(msrest.serialization.Model): """ _attribute_map = { - 'health_state': {'key': 'healthState', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'item_type': {'key': 'itemType', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'backup_engine_name': {'key': 'backupEngineName', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - 'backup_set_name': {'key': 'backupSetName', 'type': 'str'}, + "health_state": {"key": "healthState", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "item_type": {"key": "itemType", "type": "str"}, + "policy_name": {"key": "policyName", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "backup_engine_name": {"key": "backupEngineName", "type": "str"}, + "friendly_name": {"key": "friendlyName", "type": "str"}, + "fabric_name": {"key": "fabricName", "type": "str"}, + "backup_set_name": {"key": "backupSetName", "type": "str"}, } def __init__( self, *, - health_state: Optional[Union[str, "HealthState"]] = None, - backup_management_type: Optional[Union[str, "BackupManagementType"]] = None, - item_type: Optional[Union[str, "DataSourceType"]] = None, + health_state: Optional[Union[str, "_models.HealthState"]] = None, + backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, + item_type: Optional[Union[str, "_models.DataSourceType"]] = None, policy_name: Optional[str] = None, container_name: Optional[str] = None, backup_engine_name: Optional[str] = None, @@ -8507,18 +8786,18 @@ def __init__( **kwargs ): """ - :keyword health_state: Health State for the backed up item. Possible values include: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + :keyword health_state: Health State for the backed up item. Known values are: "Passed", + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_state: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthState - :keyword backup_management_type: Backup management type for the backed up item. Possible values - include: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + :keyword backup_management_type: Backup management type for the backed up item. Known values + are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType - :keyword item_type: Type of workload this item represents. Possible values include: "Invalid", - "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", - "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", + :keyword item_type: Type of workload this item represents. Known values are: "Invalid", "VM", + "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype item_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -8535,7 +8814,7 @@ def __init__( :keyword backup_set_name: Name of the backup set. :paramtype backup_set_name: str """ - super(ProtectedItemQueryObject, self).__init__(**kwargs) + super().__init__(**kwargs) self.health_state = health_state self.backup_management_type = backup_management_type self.item_type = item_type @@ -8561,7 +8840,7 @@ class ProtectedItemResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -8570,19 +8849,19 @@ class ProtectedItemResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ProtectedItem'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "ProtectedItem"}, } def __init__( @@ -8591,20 +8870,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["ProtectedItem"] = None, + properties: Optional["_models.ProtectedItem"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: ProtectedItemResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItem """ - super(ProtectedItemResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -8620,15 +8899,15 @@ class ProtectedItemResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ProtectedItemResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ProtectedItemResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["ProtectedItemResource"]] = None, + value: Optional[List["_models.ProtectedItemResource"]] = None, **kwargs ): """ @@ -8639,11 +8918,11 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResource] """ - super(ProtectedItemResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class RecoveryPointDiskConfiguration(msrest.serialization.Model): +class RecoveryPointDiskConfiguration(_serialization.Model): """Disk configuration. :ivar number_of_disks_included_in_backup: Number of disks included in backup. @@ -8659,10 +8938,10 @@ class RecoveryPointDiskConfiguration(msrest.serialization.Model): """ _attribute_map = { - 'number_of_disks_included_in_backup': {'key': 'numberOfDisksIncludedInBackup', 'type': 'int'}, - 'number_of_disks_attached_to_vm': {'key': 'numberOfDisksAttachedToVm', 'type': 'int'}, - 'included_disk_list': {'key': 'includedDiskList', 'type': '[DiskInformation]'}, - 'excluded_disk_list': {'key': 'excludedDiskList', 'type': '[DiskInformation]'}, + "number_of_disks_included_in_backup": {"key": "numberOfDisksIncludedInBackup", "type": "int"}, + "number_of_disks_attached_to_vm": {"key": "numberOfDisksAttachedToVm", "type": "int"}, + "included_disk_list": {"key": "includedDiskList", "type": "[DiskInformation]"}, + "excluded_disk_list": {"key": "excludedDiskList", "type": "[DiskInformation]"}, } def __init__( @@ -8670,8 +8949,8 @@ def __init__( *, number_of_disks_included_in_backup: Optional[int] = None, number_of_disks_attached_to_vm: Optional[int] = None, - included_disk_list: Optional[List["DiskInformation"]] = None, - excluded_disk_list: Optional[List["DiskInformation"]] = None, + included_disk_list: Optional[List["_models.DiskInformation"]] = None, + excluded_disk_list: Optional[List["_models.DiskInformation"]] = None, **kwargs ): """ @@ -8686,14 +8965,14 @@ def __init__( :paramtype excluded_disk_list: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.DiskInformation] """ - super(RecoveryPointDiskConfiguration, self).__init__(**kwargs) + super().__init__(**kwargs) self.number_of_disks_included_in_backup = number_of_disks_included_in_backup self.number_of_disks_attached_to_vm = number_of_disks_attached_to_vm self.included_disk_list = included_disk_list self.excluded_disk_list = excluded_disk_list -class RecoveryPointMoveReadinessInfo(msrest.serialization.Model): +class RecoveryPointMoveReadinessInfo(_serialization.Model): """RecoveryPointMoveReadinessInfo. :ivar is_ready_for_move: @@ -8703,24 +8982,18 @@ class RecoveryPointMoveReadinessInfo(msrest.serialization.Model): """ _attribute_map = { - 'is_ready_for_move': {'key': 'isReadyForMove', 'type': 'bool'}, - 'additional_info': {'key': 'additionalInfo', 'type': 'str'}, + "is_ready_for_move": {"key": "isReadyForMove", "type": "bool"}, + "additional_info": {"key": "additionalInfo", "type": "str"}, } - def __init__( - self, - *, - is_ready_for_move: Optional[bool] = None, - additional_info: Optional[str] = None, - **kwargs - ): + def __init__(self, *, is_ready_for_move: Optional[bool] = None, additional_info: Optional[str] = None, **kwargs): """ :keyword is_ready_for_move: :paramtype is_ready_for_move: bool :keyword additional_info: :paramtype additional_info: str """ - super(RecoveryPointMoveReadinessInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.is_ready_for_move = is_ready_for_move self.additional_info = additional_info @@ -8739,7 +9012,7 @@ class RecoveryPointResource(Resource): :vartype type: str :ivar location: Resource location. :vartype location: str - :ivar tags: A set of tags. Resource tags. + :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar e_tag: Optional ETag. :vartype e_tag: str @@ -8748,19 +9021,19 @@ class RecoveryPointResource(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'RecoveryPoint'}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "e_tag": {"key": "eTag", "type": "str"}, + "properties": {"key": "properties", "type": "RecoveryPoint"}, } def __init__( @@ -8769,20 +9042,20 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, e_tag: Optional[str] = None, - properties: Optional["RecoveryPoint"] = None, + properties: Optional["_models.RecoveryPoint"] = None, **kwargs ): """ :keyword location: Resource location. :paramtype location: str - :keyword tags: A set of tags. Resource tags. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword e_tag: Optional ETag. :paramtype e_tag: str :keyword properties: RecoveryPointResource properties. :paramtype properties: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPoint """ - super(RecoveryPointResource, self).__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) + super().__init__(location=location, tags=tags, e_tag=e_tag, **kwargs) self.properties = properties @@ -8798,15 +9071,15 @@ class RecoveryPointResourceList(ResourceList): """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[RecoveryPointResource]'}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RecoveryPointResource]"}, } def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["RecoveryPointResource"]] = None, + value: Optional[List["_models.RecoveryPointResource"]] = None, **kwargs ): """ @@ -8817,19 +9090,19 @@ def __init__( :paramtype value: list[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResource] """ - super(RecoveryPointResourceList, self).__init__(next_link=next_link, **kwargs) + super().__init__(next_link=next_link, **kwargs) self.value = value -class RecoveryPointTierInformation(msrest.serialization.Model): +class RecoveryPointTierInformation(_serialization.Model): """Recovery point tier information. - :ivar type: Recovery point tier type. Possible values include: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + :ivar type: Recovery point tier type. Known values are: "Invalid", "InstantRP", "HardenedRP", + and "ArchivedRP". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierType - :ivar status: Recovery point tier status. Possible values include: "Invalid", "Valid", - "Disabled", "Deleted", "Rehydrated". + :ivar status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", + "Deleted", and "Rehydrated". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierStatus :ivar extended_info: Recovery point tier status. @@ -8837,38 +9110,38 @@ class RecoveryPointTierInformation(msrest.serialization.Model): """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'extended_info': {'key': 'extendedInfo', 'type': '{str}'}, + "type": {"key": "type", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "{str}"}, } def __init__( self, *, - type: Optional[Union[str, "RecoveryPointTierType"]] = None, - status: Optional[Union[str, "RecoveryPointTierStatus"]] = None, + type: Optional[Union[str, "_models.RecoveryPointTierType"]] = None, + status: Optional[Union[str, "_models.RecoveryPointTierStatus"]] = None, extended_info: Optional[Dict[str, str]] = None, **kwargs ): """ - :keyword type: Recovery point tier type. Possible values include: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + :keyword type: Recovery point tier type. Known values are: "Invalid", "InstantRP", + "HardenedRP", and "ArchivedRP". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierType - :keyword status: Recovery point tier status. Possible values include: "Invalid", "Valid", - "Disabled", "Deleted", "Rehydrated". + :keyword status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", + "Deleted", and "Rehydrated". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierStatus :keyword extended_info: Recovery point tier status. :paramtype extended_info: dict[str, str] """ - super(RecoveryPointTierInformation, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.status = status self.extended_info = extended_info -class RestoreFileSpecs(msrest.serialization.Model): +class RestoreFileSpecs(_serialization.Model): """Restore file specs like file path, type and target folder path info. :ivar path: Source File/Folder path. @@ -8880,9 +9153,9 @@ class RestoreFileSpecs(msrest.serialization.Model): """ _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'file_spec_type': {'key': 'fileSpecType', 'type': 'str'}, - 'target_folder_path': {'key': 'targetFolderPath', 'type': 'str'}, + "path": {"key": "path", "type": "str"}, + "file_spec_type": {"key": "fileSpecType", "type": "str"}, + "target_folder_path": {"key": "targetFolderPath", "type": "str"}, } def __init__( @@ -8901,16 +9174,16 @@ def __init__( :keyword target_folder_path: Destination folder path in target FileShare. :paramtype target_folder_path: str """ - super(RestoreFileSpecs, self).__init__(**kwargs) + super().__init__(**kwargs) self.path = path self.file_spec_type = file_spec_type self.target_folder_path = target_folder_path -class SQLDataDirectory(msrest.serialization.Model): +class SQLDataDirectory(_serialization.Model): """SQLDataDirectory info. - :ivar type: Type of data directory mapping. Possible values include: "Invalid", "Data", "Log". + :ivar type: Type of data directory mapping. Known values are: "Invalid", "Data", and "Log". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.SQLDataDirectoryType :ivar path: File path. @@ -8920,22 +9193,21 @@ class SQLDataDirectory(msrest.serialization.Model): """ _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'logical_name': {'key': 'logicalName', 'type': 'str'}, + "type": {"key": "type", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "logical_name": {"key": "logicalName", "type": "str"}, } def __init__( self, *, - type: Optional[Union[str, "SQLDataDirectoryType"]] = None, + type: Optional[Union[str, "_models.SQLDataDirectoryType"]] = None, path: Optional[str] = None, logical_name: Optional[str] = None, **kwargs ): """ - :keyword type: Type of data directory mapping. Possible values include: "Invalid", "Data", - "Log". + :keyword type: Type of data directory mapping. Known values are: "Invalid", "Data", and "Log". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.SQLDataDirectoryType :keyword path: File path. @@ -8943,16 +9215,16 @@ def __init__( :keyword logical_name: Logical name of the file. :paramtype logical_name: str """ - super(SQLDataDirectory, self).__init__(**kwargs) + super().__init__(**kwargs) self.type = type self.path = path self.logical_name = logical_name -class SQLDataDirectoryMapping(msrest.serialization.Model): +class SQLDataDirectoryMapping(_serialization.Model): """Encapsulates information regarding data directory. - :ivar mapping_type: Type of data directory mapping. Possible values include: "Invalid", "Data", + :ivar mapping_type: Type of data directory mapping. Known values are: "Invalid", "Data", and "Log". :vartype mapping_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.SQLDataDirectoryType @@ -8965,24 +9237,24 @@ class SQLDataDirectoryMapping(msrest.serialization.Model): """ _attribute_map = { - 'mapping_type': {'key': 'mappingType', 'type': 'str'}, - 'source_logical_name': {'key': 'sourceLogicalName', 'type': 'str'}, - 'source_path': {'key': 'sourcePath', 'type': 'str'}, - 'target_path': {'key': 'targetPath', 'type': 'str'}, + "mapping_type": {"key": "mappingType", "type": "str"}, + "source_logical_name": {"key": "sourceLogicalName", "type": "str"}, + "source_path": {"key": "sourcePath", "type": "str"}, + "target_path": {"key": "targetPath", "type": "str"}, } def __init__( self, *, - mapping_type: Optional[Union[str, "SQLDataDirectoryType"]] = None, + mapping_type: Optional[Union[str, "_models.SQLDataDirectoryType"]] = None, source_logical_name: Optional[str] = None, source_path: Optional[str] = None, target_path: Optional[str] = None, **kwargs ): """ - :keyword mapping_type: Type of data directory mapping. Possible values include: "Invalid", - "Data", "Log". + :keyword mapping_type: Type of data directory mapping. Known values are: "Invalid", "Data", and + "Log". :paramtype mapping_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.SQLDataDirectoryType :keyword source_logical_name: Restore source logical name path. @@ -8992,14 +9264,14 @@ def __init__( :keyword target_path: Target path. :paramtype target_path: str """ - super(SQLDataDirectoryMapping, self).__init__(**kwargs) + super().__init__(**kwargs) self.mapping_type = mapping_type self.source_logical_name = source_logical_name self.source_path = source_path self.target_path = target_path -class TargetAFSRestoreInfo(msrest.serialization.Model): +class TargetAFSRestoreInfo(_serialization.Model): """Target Azure File Share Info. :ivar name: File share name. @@ -9009,33 +9281,27 @@ class TargetAFSRestoreInfo(msrest.serialization.Model): """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + "name": {"key": "name", "type": "str"}, + "target_resource_id": {"key": "targetResourceId", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - target_resource_id: Optional[str] = None, - **kwargs - ): + def __init__(self, *, name: Optional[str] = None, target_resource_id: Optional[str] = None, **kwargs): """ :keyword name: File share name. :paramtype name: str :keyword target_resource_id: Target file share resource ARM ID. :paramtype target_resource_id: str """ - super(TargetAFSRestoreInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = name self.target_resource_id = target_resource_id -class TargetRestoreInfo(msrest.serialization.Model): +class TargetRestoreInfo(_serialization.Model): """Details about target workload during restore operation. - :ivar overwrite_option: Can Overwrite if Target DataBase already exists. Possible values - include: "Invalid", "FailOnConflict", "Overwrite". + :ivar overwrite_option: Can Overwrite if Target DataBase already exists. Known values are: + "Invalid", "FailOnConflict", and "Overwrite". :vartype overwrite_option: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OverwriteOptions :ivar container_id: Resource Id name of the container in which Target DataBase resides. @@ -9048,24 +9314,24 @@ class TargetRestoreInfo(msrest.serialization.Model): """ _attribute_map = { - 'overwrite_option': {'key': 'overwriteOption', 'type': 'str'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, - 'database_name': {'key': 'databaseName', 'type': 'str'}, - 'target_directory_for_file_restore': {'key': 'targetDirectoryForFileRestore', 'type': 'str'}, + "overwrite_option": {"key": "overwriteOption", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "target_directory_for_file_restore": {"key": "targetDirectoryForFileRestore", "type": "str"}, } def __init__( self, *, - overwrite_option: Optional[Union[str, "OverwriteOptions"]] = None, + overwrite_option: Optional[Union[str, "_models.OverwriteOptions"]] = None, container_id: Optional[str] = None, database_name: Optional[str] = None, target_directory_for_file_restore: Optional[str] = None, **kwargs ): """ - :keyword overwrite_option: Can Overwrite if Target DataBase already exists. Possible values - include: "Invalid", "FailOnConflict", "Overwrite". + :keyword overwrite_option: Can Overwrite if Target DataBase already exists. Known values are: + "Invalid", "FailOnConflict", and "Overwrite". :paramtype overwrite_option: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OverwriteOptions :keyword container_id: Resource Id name of the container in which Target DataBase resides. @@ -9076,20 +9342,19 @@ def __init__( :keyword target_directory_for_file_restore: Target directory location for restore as files. :paramtype target_directory_for_file_restore: str """ - super(TargetRestoreInfo, self).__init__(**kwargs) + super().__init__(**kwargs) self.overwrite_option = overwrite_option self.container_id = container_id self.database_name = database_name self.target_directory_for_file_restore = target_directory_for_file_restore -class WorkloadCrrAccessToken(CrrAccessToken): +class WorkloadCrrAccessToken(CrrAccessToken): # pylint: disable=too-many-instance-attributes """WorkloadCrrAccessToken. All required parameters must be populated in order to send to Azure. - :ivar object_type: Required. Type of the specific object - used for deserializing.Constant - filled by server. + :ivar object_type: Type of the specific object - used for deserializing. Required. :vartype object_type: str :ivar access_token_string: Access token used for authentication. :vartype access_token_string: str @@ -9102,7 +9367,7 @@ class WorkloadCrrAccessToken(CrrAccessToken): :ivar resource_id: Resource Id of the source vault. :vartype resource_id: str :ivar protection_container_id: Protected item container id. - :vartype protection_container_id: long + :vartype protection_container_id: int :ivar recovery_point_id: Recovery Point Id. :vartype recovery_point_id: str :ivar recovery_point_time: Recovery Point Time. @@ -9165,48 +9430,51 @@ class WorkloadCrrAccessToken(CrrAccessToken): """ _validation = { - 'object_type': {'required': True}, + "object_type": {"required": True}, } _attribute_map = { - 'object_type': {'key': 'objectType', 'type': 'str'}, - 'access_token_string': {'key': 'accessTokenString', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'protection_container_id': {'key': 'protectionContainerId', 'type': 'long'}, - 'recovery_point_id': {'key': 'recoveryPointId', 'type': 'str'}, - 'recovery_point_time': {'key': 'recoveryPointTime', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'container_type': {'key': 'containerType', 'type': 'str'}, - 'backup_management_type': {'key': 'backupManagementType', 'type': 'str'}, - 'datasource_type': {'key': 'datasourceType', 'type': 'str'}, - 'datasource_name': {'key': 'datasourceName', 'type': 'str'}, - 'datasource_id': {'key': 'datasourceId', 'type': 'str'}, - 'datasource_container_name': {'key': 'datasourceContainerName', 'type': 'str'}, - 'coordinator_service_stamp_id': {'key': 'coordinatorServiceStampId', 'type': 'str'}, - 'coordinator_service_stamp_uri': {'key': 'coordinatorServiceStampUri', 'type': 'str'}, - 'protection_service_stamp_id': {'key': 'protectionServiceStampId', 'type': 'str'}, - 'protection_service_stamp_uri': {'key': 'protectionServiceStampUri', 'type': 'str'}, - 'token_extended_information': {'key': 'tokenExtendedInformation', 'type': 'str'}, - 'rp_tier_information': {'key': 'rpTierInformation', 'type': '{str}'}, - 'rp_original_sa_option': {'key': 'rpOriginalSAOption', 'type': 'bool'}, - 'rp_is_managed_virtual_machine': {'key': 'rpIsManagedVirtualMachine', 'type': 'bool'}, - 'rp_vm_size_description': {'key': 'rpVMSizeDescription', 'type': 'str'}, - 'b_ms_active_region': {'key': 'bMSActiveRegion', 'type': 'str'}, - 'protectable_object_unique_name': {'key': 'protectableObjectUniqueName', 'type': 'str'}, - 'protectable_object_friendly_name': {'key': 'protectableObjectFriendlyName', 'type': 'str'}, - 'protectable_object_workload_type': {'key': 'protectableObjectWorkloadType', 'type': 'str'}, - 'protectable_object_protection_state': {'key': 'protectableObjectProtectionState', 'type': 'str'}, - 'protectable_object_container_host_os_name': {'key': 'protectableObjectContainerHostOsName', 'type': 'str'}, - 'protectable_object_parent_logical_container_name': {'key': 'protectableObjectParentLogicalContainerName', 'type': 'str'}, - 'container_id': {'key': 'containerId', 'type': 'str'}, - 'policy_name': {'key': 'policyName', 'type': 'str'}, - 'policy_id': {'key': 'policyId', 'type': 'str'}, - } - - def __init__( + "object_type": {"key": "objectType", "type": "str"}, + "access_token_string": {"key": "accessTokenString", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "resource_group_name": {"key": "resourceGroupName", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "protection_container_id": {"key": "protectionContainerId", "type": "int"}, + "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, + "recovery_point_time": {"key": "recoveryPointTime", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + "container_type": {"key": "containerType", "type": "str"}, + "backup_management_type": {"key": "backupManagementType", "type": "str"}, + "datasource_type": {"key": "datasourceType", "type": "str"}, + "datasource_name": {"key": "datasourceName", "type": "str"}, + "datasource_id": {"key": "datasourceId", "type": "str"}, + "datasource_container_name": {"key": "datasourceContainerName", "type": "str"}, + "coordinator_service_stamp_id": {"key": "coordinatorServiceStampId", "type": "str"}, + "coordinator_service_stamp_uri": {"key": "coordinatorServiceStampUri", "type": "str"}, + "protection_service_stamp_id": {"key": "protectionServiceStampId", "type": "str"}, + "protection_service_stamp_uri": {"key": "protectionServiceStampUri", "type": "str"}, + "token_extended_information": {"key": "tokenExtendedInformation", "type": "str"}, + "rp_tier_information": {"key": "rpTierInformation", "type": "{str}"}, + "rp_original_sa_option": {"key": "rpOriginalSAOption", "type": "bool"}, + "rp_is_managed_virtual_machine": {"key": "rpIsManagedVirtualMachine", "type": "bool"}, + "rp_vm_size_description": {"key": "rpVMSizeDescription", "type": "str"}, + "b_ms_active_region": {"key": "bMSActiveRegion", "type": "str"}, + "protectable_object_unique_name": {"key": "protectableObjectUniqueName", "type": "str"}, + "protectable_object_friendly_name": {"key": "protectableObjectFriendlyName", "type": "str"}, + "protectable_object_workload_type": {"key": "protectableObjectWorkloadType", "type": "str"}, + "protectable_object_protection_state": {"key": "protectableObjectProtectionState", "type": "str"}, + "protectable_object_container_host_os_name": {"key": "protectableObjectContainerHostOsName", "type": "str"}, + "protectable_object_parent_logical_container_name": { + "key": "protectableObjectParentLogicalContainerName", + "type": "str", + }, + "container_id": {"key": "containerId", "type": "str"}, + "policy_name": {"key": "policyName", "type": "str"}, + "policy_id": {"key": "policyId", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals self, *, access_token_string: Optional[str] = None, @@ -9257,7 +9525,7 @@ def __init__( :keyword resource_id: Resource Id of the source vault. :paramtype resource_id: str :keyword protection_container_id: Protected item container id. - :paramtype protection_container_id: long + :paramtype protection_container_id: int :keyword recovery_point_id: Recovery Point Id. :paramtype recovery_point_id: str :keyword recovery_point_time: Recovery Point Time. @@ -9319,8 +9587,35 @@ def __init__( :keyword policy_id: Policy Id. :paramtype policy_id: str """ - super(WorkloadCrrAccessToken, self).__init__(access_token_string=access_token_string, subscription_id=subscription_id, resource_group_name=resource_group_name, resource_name=resource_name, resource_id=resource_id, protection_container_id=protection_container_id, recovery_point_id=recovery_point_id, recovery_point_time=recovery_point_time, container_name=container_name, container_type=container_type, backup_management_type=backup_management_type, datasource_type=datasource_type, datasource_name=datasource_name, datasource_id=datasource_id, datasource_container_name=datasource_container_name, coordinator_service_stamp_id=coordinator_service_stamp_id, coordinator_service_stamp_uri=coordinator_service_stamp_uri, protection_service_stamp_id=protection_service_stamp_id, protection_service_stamp_uri=protection_service_stamp_uri, token_extended_information=token_extended_information, rp_tier_information=rp_tier_information, rp_original_sa_option=rp_original_sa_option, rp_is_managed_virtual_machine=rp_is_managed_virtual_machine, rp_vm_size_description=rp_vm_size_description, b_ms_active_region=b_ms_active_region, **kwargs) - self.object_type = 'WorkloadCrrAccessToken' # type: str + super().__init__( + access_token_string=access_token_string, + subscription_id=subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + resource_id=resource_id, + protection_container_id=protection_container_id, + recovery_point_id=recovery_point_id, + recovery_point_time=recovery_point_time, + container_name=container_name, + container_type=container_type, + backup_management_type=backup_management_type, + datasource_type=datasource_type, + datasource_name=datasource_name, + datasource_id=datasource_id, + datasource_container_name=datasource_container_name, + coordinator_service_stamp_id=coordinator_service_stamp_id, + coordinator_service_stamp_uri=coordinator_service_stamp_uri, + protection_service_stamp_id=protection_service_stamp_id, + protection_service_stamp_uri=protection_service_stamp_uri, + token_extended_information=token_extended_information, + rp_tier_information=rp_tier_information, + rp_original_sa_option=rp_original_sa_option, + rp_is_managed_virtual_machine=rp_is_managed_virtual_machine, + rp_vm_size_description=rp_vm_size_description, + b_ms_active_region=b_ms_active_region, + **kwargs + ) + self.object_type = "WorkloadCrrAccessToken" # type: str self.protectable_object_unique_name = protectable_object_unique_name self.protectable_object_friendly_name = protectable_object_friendly_name self.protectable_object_workload_type = protectable_object_workload_type diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_recovery_services_backup_passive_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_recovery_services_backup_passive_client_enums.py index a8be240f6e5e6..2310d33558348 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_recovery_services_backup_passive_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_recovery_services_backup_passive_client_enums.py @@ -7,13 +7,11 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class BackupManagementType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup management type to execute the current job. - """ +class BackupManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup management type to execute the current job.""" INVALID = "Invalid" AZURE_IAAS_VM = "AzureIaasVM" @@ -25,9 +23,9 @@ class BackupManagementType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AZURE_WORKLOAD = "AzureWorkload" DEFAULT_BACKUP = "DefaultBackup" -class CopyOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Options to resolve copy conflicts. - """ + +class CopyOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Options to resolve copy conflicts.""" INVALID = "Invalid" CREATE_COPY = "CreateCopy" @@ -35,7 +33,8 @@ class CopyOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OVERWRITE = "Overwrite" FAIL_ON_CONFLICT = "FailOnConflict" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Create mode to indicate recovery of existing soft deleted data source or creation of new data source. """ @@ -44,9 +43,9 @@ class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" RECOVER = "Recover" -class DataSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of workload this item represents. - """ + +class DataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of workload this item represents.""" INVALID = "Invalid" VM = "VM" @@ -64,27 +63,27 @@ class DataSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SAP_HANA_DATABASE = "SAPHanaDatabase" SAP_ASE_DATABASE = "SAPAseDatabase" -class HealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Health State for the backed up item. - """ + +class HealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Health State for the backed up item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" -class HealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """backups running status for this backup item. - """ + +class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """backups running status for this backup item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" -class JobOperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of operation. - """ + +class JobOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of operation.""" INVALID = "Invalid" REGISTER = "Register" @@ -98,9 +97,9 @@ class JobOperationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNDELETE = "Undelete" UPDATE_CUSTOMER_MANAGED_KEY = "UpdateCustomerManagedKey" -class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Status of the job. - """ + +class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the job.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -110,24 +109,26 @@ class JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CANCELLED = "Cancelled" CANCELLING = "Cancelling" -class JobSupportedAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class JobSupportedAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JobSupportedAction.""" INVALID = "Invalid" CANCELLABLE = "Cancellable" RETRIABLE = "Retriable" -class LastBackupStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Last backup operation status. Possible values: Healthy, Unhealthy. - """ + +class LastBackupStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Last backup operation status. Possible values: Healthy, Unhealthy.""" INVALID = "Invalid" HEALTHY = "Healthy" UNHEALTHY = "Unhealthy" IR_PENDING = "IRPending" -class MabServerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Server type of MAB container. - """ + +class MabServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Server type of MAB container.""" INVALID = "Invalid" UNKNOWN = "Unknown" @@ -145,9 +146,9 @@ class MabServerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STORAGE_CONTAINER = "StorageContainer" GENERIC_CONTAINER = "GenericContainer" -class OperationStatusValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Operation status. - """ + +class OperationStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operation status.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -155,17 +156,17 @@ class OperationStatusValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class OverwriteOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Can Overwrite if Target DataBase already exists - """ + +class OverwriteOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Can Overwrite if Target DataBase already exists.""" INVALID = "Invalid" FAIL_ON_CONFLICT = "FailOnConflict" OVERWRITE = "Overwrite" -class ProtectedItemHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Health status of the backup item, evaluated based on last heartbeat received - """ + +class ProtectedItemHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Health status of the backup item, evaluated based on last heartbeat received.""" INVALID = "Invalid" HEALTHY = "Healthy" @@ -173,9 +174,9 @@ class ProtectedItemHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enu NOT_REACHABLE = "NotReachable" IR_PENDING = "IRPending" -class ProtectedItemState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup state of the backed up item. - """ + +class ProtectedItemState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup state of the backed up item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -184,9 +185,9 @@ class ProtectedItemState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" -class ProtectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup state of this backup item. - """ + +class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup state of this backup item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -195,17 +196,17 @@ class ProtectionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" -class RecoveryMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Defines whether the current recovery mode is file restore or database restore - """ + +class RecoveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines whether the current recovery mode is file restore or database restore.""" INVALID = "Invalid" FILE_RECOVERY = "FileRecovery" WORKLOAD_RECOVERY = "WorkloadRecovery" -class RecoveryPointTierStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Recovery point tier status. - """ + +class RecoveryPointTierStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recovery point tier status.""" INVALID = "Invalid" VALID = "Valid" @@ -213,18 +214,18 @@ class RecoveryPointTierStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) DELETED = "Deleted" REHYDRATED = "Rehydrated" -class RecoveryPointTierType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Recovery point tier type. - """ + +class RecoveryPointTierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Recovery point tier type.""" INVALID = "Invalid" INSTANT_RP = "InstantRP" HARDENED_RP = "HardenedRP" ARCHIVED_RP = "ArchivedRP" -class RecoveryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of this recovery. - """ + +class RecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of this recovery.""" INVALID = "Invalid" ORIGINAL_LOCATION = "OriginalLocation" @@ -232,9 +233,9 @@ class RecoveryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RESTORE_DISKS = "RestoreDisks" OFFLINE = "Offline" -class ResourceHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Resource Health Status - """ + +class ResourceHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource Health Status.""" HEALTHY = "Healthy" TRANSIENT_DEGRADED = "TransientDegraded" @@ -243,9 +244,9 @@ class ResourceHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PERSISTENT_UNHEALTHY = "PersistentUnhealthy" INVALID = "Invalid" -class RestorePointQueryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """RestorePoint type - """ + +class RestorePointQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RestorePoint type.""" INVALID = "Invalid" FULL = "Full" @@ -255,9 +256,9 @@ class RestorePointQueryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "All" INCREMENTAL = "Incremental" -class RestorePointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of restore point - """ + +class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of restore point.""" INVALID = "Invalid" FULL = "Full" @@ -265,25 +266,25 @@ class RestorePointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DIFFERENTIAL = "Differential" INCREMENTAL = "Incremental" -class RestoreRequestType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Restore Type (FullShareRestore or ItemLevelRestore) - """ + +class RestoreRequestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Restore Type (FullShareRestore or ItemLevelRestore).""" INVALID = "Invalid" FULL_SHARE_RESTORE = "FullShareRestore" ITEM_LEVEL_RESTORE = "ItemLevelRestore" -class SQLDataDirectoryType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of data directory mapping - """ + +class SQLDataDirectoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of data directory mapping.""" INVALID = "Invalid" DATA = "Data" LOG = "Log" -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Storage type - """ + +class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Storage type.""" INVALID = "Invalid" GEO_REDUNDANT = "GeoRedundant" @@ -291,7 +292,8 @@ class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ZONE_REDUNDANT = "ZoneRedundant" READ_ACCESS_GEO_ZONE_REDUNDANT = "ReadAccessGeoZoneRedundant" -class StorageTypeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + +class StorageTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. """ @@ -300,17 +302,17 @@ class StorageTypeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOCKED = "Locked" UNLOCKED = "Unlocked" -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Backup management type for this container. - """ + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Backup management type for this container.""" INVALID = "Invalid" BACKUP_PROTECTED_ITEM_COUNT_SUMMARY = "BackupProtectedItemCountSummary" BACKUP_PROTECTION_CONTAINER_COUNT_SUMMARY = "BackupProtectionContainerCountSummary" -class UsagesUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Unit of the usage. - """ + +class UsagesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Unit of the usage.""" COUNT = "Count" BYTES = "Bytes" @@ -319,9 +321,9 @@ class UsagesUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COUNT_PER_SECOND = "CountPerSecond" BYTES_PER_SECOND = "BytesPerSecond" -class WorkloadType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Workload type of backup item. - """ + +class WorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Workload type of backup item.""" INVALID = "Invalid" VM = "VM" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py index 7ac30ce43fb34..cc07a4210734f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py @@ -18,16 +18,22 @@ from ._recovery_points_crr_operations import RecoveryPointsCrrOperations from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'BackupUsageSummariesCRROperations', - 'AadPropertiesOperations', - 'CrossRegionRestoreOperations', - 'BackupCrrJobDetailsOperations', - 'BackupCrrJobsOperations', - 'CrrOperationResultsOperations', - 'CrrOperationStatusOperations', - 'RecoveryPointsOperations', - 'BackupResourceStorageConfigsOperations', - 'RecoveryPointsCrrOperations', - 'BackupProtectedItemsCrrOperations', + "BackupUsageSummariesCRROperations", + "AadPropertiesOperations", + "CrossRegionRestoreOperations", + "BackupCrrJobDetailsOperations", + "BackupCrrJobsOperations", + "CrrOperationResultsOperations", + "CrrOperationStatusOperations", + "RecoveryPointsOperations", + "BackupResourceStorageConfigsOperations", + "RecoveryPointsCrrOperations", + "BackupProtectedItemsCrrOperations", ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py index 7c754f4f46390..a0e49101bddad 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py @@ -8,126 +8,122 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_request( - azure_region: str, - subscription_id: str, - *, - filter: Optional[str] = None, - **kwargs: Any + azure_region: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class AadPropertiesOperations(object): - """AadPropertiesOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AadPropertiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`aad_properties` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - azure_region: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> "_models.AADPropertiesResource": + def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> _models.AADPropertiesResource: """Fetches the AAD properties from target region BCM stamp. Fetches the AAD properties from target region BCM stamp. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: AADPropertiesResource, or the result of cls(response) + :return: AADPropertiesResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AADPropertiesResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.AADPropertiesResource] - request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, - template_url=self.get.metadata['url'], + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -135,12 +131,11 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('AADPropertiesResource', pipeline_response) + deserialized = self._deserialize("AADPropertiesResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py index 06c2f639184b2..c994456d45cb8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py @@ -6,119 +6,167 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - azure_region: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + +def build_get_request(azure_region: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupCrrJobDetailsOperations(object): - """BackupCrrJobDetailsOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupCrrJobDetailsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_crr_job_details` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace + @overload def get( self, azure_region: str, - parameters: "_models.CrrJobRequest", + parameters: _models.CrrJobRequest, + *, + content_type: str = "application/json", **kwargs: Any - ) -> "_models.JobResource": + ) -> _models.JobResource: """Get CRR job details from target region. Get CRR job details from target region. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: CRR Job request. + :param parameters: CRR Job request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.JobResource: + """Get CRR job details from target region. + + Get CRR job details from target region. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: CRR Job request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get( + self, azure_region: str, parameters: Union[_models.CrrJobRequest, IO], **kwargs: Any + ) -> _models.JobResource: + """Get CRR job details from target region. + + Get CRR job details from target region. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: CRR Job request. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: JobResource, or the result of cls(response) + :return: JobResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] - _json = self._serialize.body(parameters, 'CrrJobRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrrJobRequest") request = build_get_request( azure_region=azure_region, @@ -126,16 +174,18 @@ def get( api_version=api_version, content_type=content_type, json=_json, - template_url=self.get.metadata['url'], + content=_content, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -143,12 +193,11 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('JobResource', pipeline_response) + deserialized = self._deserialize("JobResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py index beeaf77c93054..8469c654816d4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py @@ -6,163 +6,170 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( azure_region: str, subscription_id: str, *, - json: JSONType = None, - content: Any = None, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupCrrJobsOperations(object): - """BackupCrrJobsOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupCrrJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_crr_jobs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( self, azure_region: str, - parameters: "_models.CrrJobRequest", + parameters: Union[_models.CrrJobRequest, IO], filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.JobResourceList"]: + ) -> Iterable["_models.JobResource"]: """Gets the list of CRR jobs from the target region. Gets the list of CRR jobs from the target region. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: Backup CRR Job request. - :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest + :param parameters: Backup CRR Job request. Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest or IO :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either JobResourceList or the result of cls(response) + :return: An iterator like instance of either JobResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - _json = self._serialize.body(parameters, 'CrrJobRequest') - + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrrJobRequest") + request = build_list_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, api_version=api_version, content_type=content_type, json=_json, - filter=filter, - skip_token=skip_token, - template_url=self.list.metadata['url'], + content=_content, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - _json = self._serialize.body(parameters, 'CrrJobRequest') - - request = build_list_request( - azure_region=azure_region, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -176,10 +183,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -190,8 +195,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py index d70b4e4ee65a1..156910f518f30 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupProtectedItemsCrrOperations(object): - """BackupProtectedItemsCrrOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupProtectedItemsCrrOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_protected_items_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,60 +103,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ProtectedItemResourceList"]: + ) -> Iterable["_models.ProtectedItemResource"]: """Provides a pageable list of all items that are backed up within a vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProtectedItemResourceList or the result of + :return: An iterator like instance of either ProtectedItemResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -165,10 +169,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -179,8 +181,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py index 911bd41bbd281..fa6b6620f3c09 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py @@ -6,214 +6,184 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - accept = "application/json" +def build_get_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_patch_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_patch_request(vault_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BackupResourceStorageConfigsOperations(object): - """BackupResourceStorageConfigsOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupResourceStorageConfigsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_resource_storage_configs` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - vault_name: str, - resource_group_name: str, - **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _models.BackupResourceConfigResource: """Fetches resource storage config. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] - request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,49 +191,115 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + @overload + def update( + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BackupResourceConfigResource: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupResourceConfigResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def update( self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any - ) -> "_models.BackupResourceConfigResource": + ) -> _models.BackupResourceConfigResource: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: BackupResourceConfigResource, or the result of cls(response) + :return: BackupResourceConfigResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupResourceConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_update_request( vault_name=vault_name, @@ -272,16 +308,18 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata['url'], + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -289,49 +327,115 @@ def update( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BackupResourceConfigResource', pipeline_response) + deserialized = self._deserialize("BackupResourceConfigResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + + @overload + def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: _models.BackupResourceConfigResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + resource_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates vault storage model type. + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param parameters: Vault storage config request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, - parameters: "_models.BackupResourceConfigResource", + parameters: Union[_models.BackupResourceConfigResource, IO], **kwargs: Any ) -> None: """Updates vault storage model type. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param parameters: Vault storage config request. + :param parameters: Vault storage config request. Is either a model type or a IO type. Required. :type parameters: - ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupResourceConfigResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'BackupResourceConfigResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "BackupResourceConfigResource") request = build_patch_request( vault_name=vault_name, @@ -340,16 +444,18 @@ def patch( # pylint: disable=inconsistent-return-statements api_version=api_version, content_type=content_type, json=_json, - template_url=self.patch.metadata['url'], + content=_content, + template_url=self.patch.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -360,5 +466,4 @@ def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore - + patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py index 79a7b5d020299..384bf549a8a0c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py @@ -7,25 +7,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, @@ -35,60 +44,56 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BackupUsageSummariesCRROperations(object): - """BackupUsageSummariesCRROperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupUsageSummariesCRROperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`backup_usage_summaries_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -98,60 +103,59 @@ def list( filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.BackupManagementUsageList"]: + ) -> Iterable["_models.BackupManagementUsage"]: """Fetches the backup management usage summaries of the vault. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupManagementUsageList or the result of + :return: An iterator like instance of either BackupManagementUsage or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsageList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsage] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, filter=filter, skip_token=skip_token, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - filter=filter, - skip_token=skip_token, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -165,10 +169,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -179,8 +181,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py index bbba09dc26a67..c7e4f250bc639 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py @@ -6,141 +6,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_trigger_request_initial( - azure_region: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" + +def build_trigger_request(azure_region: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class CrossRegionRestoreOperations(object): - """CrossRegionRestoreOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class CrossRegionRestoreOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`cross_region_restore` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _trigger_initial( # pylint: disable=inconsistent-return-statements - self, - azure_region: str, - parameters: "_models.CrossRegionRestoreRequest", - **kwargs: Any + self, azure_region: str, parameters: Union[_models.CrossRegionRestoreRequest, IO], **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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] - _json = self._serialize.body(parameters, 'CrossRegionRestoreRequest') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CrossRegionRestoreRequest") - request = build_trigger_request_initial( + request = build_trigger_request( azure_region=azure_region, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self._trigger_initial.metadata['url'], + content=_content, + template_url=self._trigger_initial.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore - + _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore - @distributed_trace - def begin_trigger( # pylint: disable=inconsistent-return-statements + @overload + def begin_trigger( self, azure_region: str, - parameters: "_models.CrossRegionRestoreRequest", + parameters: _models.CrossRegionRestoreRequest, + *, + content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: """Restores the specified backed up data in a different region as compared to where the data is @@ -149,11 +151,14 @@ def begin_trigger( # pylint: disable=inconsistent-return-statements Restores the specified backed up data in a different region as compared to where the data is backed up. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param parameters: resource cross region restore request. + :param parameters: resource cross region restore request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrossRegionRestoreRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -164,43 +169,111 @@ def begin_trigger( # pylint: disable=inconsistent-return-statements Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + + @overload + def begin_trigger( + self, azure_region: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Restores the specified backed up data in a different region as compared to where the data is + backed up. + + Restores the specified backed up data in a different region as compared to where the data is + backed up. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: resource cross region restore request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger( + self, azure_region: str, parameters: Union[_models.CrossRegionRestoreRequest, IO], **kwargs: Any + ) -> LROPoller[None]: + """Restores the specified backed up data in a different region as compared to where the data is + backed up. + + Restores the specified backed up data in a different region as compared to where the data is + backed up. + + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :param parameters: resource cross region restore request. Is either a model type or a IO type. + Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrossRegionRestoreRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + 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( + raw_result = self._trigger_initial( # type: ignore azure_region=azure_region, parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling + if polling is True: + polling_method = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) # type: PollingMethod + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore + begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py index b5ebcda3823f9..79e17d509522a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py @@ -8,122 +8,119 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - azure_region: str, - subscription_id: str, - operation_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - accept = "application/json" +def build_get_request(azure_region: str, operation_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class CrrOperationResultsOperations(object): - """CrrOperationResultsOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CrrOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`crr_operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( # pylint: disable=inconsistent-return-statements - self, - azure_region: str, - operation_id: str, - **kwargs: Any + self, azure_region: str, operation_id: str, **kwargs: Any ) -> None: """get. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_get_request( azure_region=azure_region, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -134,5 +131,4 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py index 3b041c1f47407..66a5e3b3a29fa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py @@ -8,122 +8,117 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - azure_region: str, - subscription_id: str, - operation_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - accept = "application/json" +def build_get_request(azure_region: str, operation_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}", + ) # pylint: disable=line-too-long path_format_arguments = { - "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + "azureRegion": _SERIALIZER.url("azure_region", azure_region, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class CrrOperationStatusOperations(object): - """CrrOperationStatusOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class CrrOperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`crr_operation_status` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, - azure_region: str, - operation_id: str, - **kwargs: Any - ) -> "_models.OperationStatus": + def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.OperationStatus: """get. - :param azure_region: Azure region to hit Api. + :param azure_region: Azure region to hit Api. Required. :type azure_region: str - :param operation_id: + :param operation_id: Required. :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationStatus, or the result of cls(response) + :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatus - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatus"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - request = build_get_request( azure_region=azure_region, - subscription_id=self._config.subscription_id, operation_id=operation_id, + subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,12 +126,11 @@ def get( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('OperationStatus', pipeline_response) + deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_patch.py new file mode 100644 index 0000000000000..f7dd32510333d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py index f9812d2d2321b..ac1479774dc37 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py @@ -7,91 +7,96 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from urllib.parse import parse_qs, urljoin, urlparse + +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 HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_list_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RecoveryPointsCrrOperations(object): - """RecoveryPointsCrrOperations 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.recoveryservicesbackup.passivestamp.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. + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RecoveryPointsCrrOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`recovery_points_crr` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -103,68 +108,65 @@ def list( protected_item_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RecoveryPointResourceList"]: + ) -> Iterable["_models.RecoveryPointResource"]: """Lists the backup copies for the backed up item. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the backed up item. + :param fabric_name: Fabric name associated with the backed up item. Required. :type fabric_name: str - :param container_name: Container name associated with the backed up item. + :param container_name: Container name associated with the backed up item. Required. :type container_name: str - :param protected_item_name: Backed up item whose backup copies are to be fetched. + :param protected_item_name: Backed up item whose backup copies are to be fetched. Required. :type protected_item_name: str :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoveryPointResourceList or the result of + :return: An iterator like instance of either RecoveryPointResource or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResourceList] - :raises: ~azure.core.exceptions.HttpResponseError + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-11-15") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop("error_map", {}) or {}) - cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, - api_version=api_version, + subscription_id=self._config.subscription_id, filter=filter, - template_url=self.list.metadata['url'], + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - vault_name=vault_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - fabric_name=fabric_name, - container_name=container_name, - protected_item_name=protected_item_name, - api_version=api_version, - filter=filter, - template_url=next_link, - ) + # make call to next link with the client's api-version + _parsed_next_link = urlparse(next_link) + _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -178,10 +180,8 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,8 +192,6 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py index a390df713f38c..710eb3521d454 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py @@ -6,98 +6,180 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_access_token_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, recovery_point_id: str, - *, - json: JSONType = None, - content: Any = None, + subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") - accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken", + ) # pylint: disable=line-too-long path_format_arguments = { - "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), - "containerName": _SERIALIZER.url("container_name", container_name, 'str'), - "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), + "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class 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.recoveryservicesbackup.passivestamp.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. + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.passivestamp.RecoveryServicesBackupPassiveClient`'s + :attr:`recovery_points` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def get_access_token( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: _models.AADPropertiesResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CrrAccessTokenResource: + """Returns the Access token for communication between BMS and Protection service. + + Returns the Access token for communication between BMS and Protection service. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container. Required. + :type container_name: str + :param protected_item_name: Name of the Protected Item. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery Point Id. Required. + :type recovery_point_id: str + :param parameters: Get Access Token request. Required. + :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CrrAccessTokenResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_access_token( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + recovery_point_id: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CrrAccessTokenResource: + """Returns the Access token for communication between BMS and Protection service. + + Returns the Access token for communication between BMS and Protection service. + + :param vault_name: The name of the recovery services vault. Required. + :type vault_name: str + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param fabric_name: Fabric name associated with the container. Required. + :type fabric_name: str + :param container_name: Name of the container. Required. + :type container_name: str + :param protected_item_name: Name of the Protected Item. Required. + :type protected_item_name: str + :param recovery_point_id: Recovery Point Id. Required. + :type recovery_point_id: str + :param parameters: Get Access Token request. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CrrAccessTokenResource or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def get_access_token( @@ -108,65 +190,83 @@ def get_access_token( container_name: str, protected_item_name: str, recovery_point_id: str, - parameters: "_models.AADPropertiesResource", + parameters: Union[_models.AADPropertiesResource, IO], **kwargs: Any - ) -> "_models.CrrAccessTokenResource": + ) -> _models.CrrAccessTokenResource: """Returns the Access token for communication between BMS and Protection service. Returns the Access token for communication between BMS and Protection service. - :param vault_name: The name of the recovery services vault. + :param vault_name: The name of the recovery services vault. Required. :type vault_name: str :param resource_group_name: The name of the resource group where the recovery services vault is - present. + present. Required. :type resource_group_name: str - :param fabric_name: Fabric name associated with the container. + :param fabric_name: Fabric name associated with the container. Required. :type fabric_name: str - :param container_name: Name of the container. + :param container_name: Name of the container. Required. :type container_name: str - :param protected_item_name: Name of the Protected Item. + :param protected_item_name: Name of the Protected Item. Required. :type protected_item_name: str - :param recovery_point_id: Recovery Point Id. + :param recovery_point_id: Recovery Point Id. Required. :type recovery_point_id: str - :param parameters: Get Access Token request. + :param parameters: Get Access Token request. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.AADPropertiesResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CrrAccessTokenResource, or the result of cls(response) + :return: CrrAccessTokenResource or the result of cls(response) :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrAccessTokenResource - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CrrAccessTokenResource"] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-15") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.CrrAccessTokenResource] - _json = self._serialize.body(parameters, 'AADPropertiesResource') + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "AADPropertiesResource") request = build_get_access_token_request( vault_name=vault_name, resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.get_access_token.metadata['url'], + content=_content, + template_url=self.get_access_token.metadata["url"], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,12 +274,11 @@ def get_access_token( error = self._deserialize.failsafe_deserialize(_models.NewErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CrrAccessTokenResource', pipeline_response) + deserialized = self._deserialize("CrrAccessTokenResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore - + get_access_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore