From 1362cfa57e452bdcdb166cb41dab874809162d8e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 17 Oct 2022 05:34:29 +0000 Subject: [PATCH] CodeGen from PR 21142 in Azure/azure-rest-api-specs Merge 8f168aea9475f81fa87f496e8cce8ea80150edfe into 6e2678d484fbfd56296a37eb7fcfb38455e959a2 --- .../_meta.json | 10 +- .../activestamp/__init__.py | 3 +- .../activestamp/_configuration.py | 44 +- .../_recovery_services_backup_client.py | 138 +- .../activestamp/_serialization.py | 1970 ++++ .../activestamp/_vendor.py | 12 +- .../activestamp/aio/__init__.py | 3 +- .../activestamp/aio/_configuration.py | 46 +- .../aio/_recovery_services_backup_client.py | 138 +- .../activestamp/aio/_vendor.py | 5 +- .../activestamp/aio/operations/__init__.py | 107 +- .../operations/_backup_engines_operations.py | 117 +- .../aio/operations/_backup_jobs_operations.py | 79 +- .../_backup_operation_results_operations.py | 54 +- .../_backup_operation_statuses_operations.py | 56 +- .../operations/_backup_policies_operations.py | 84 +- .../_backup_protectable_items_operations.py | 81 +- .../_backup_protected_items_operations.py | 79 +- ...backup_protection_containers_operations.py | 84 +- .../_backup_protection_intent_operations.py | 79 +- ..._resource_encryption_configs_operations.py | 161 +- ...urce_storage_configs_non_crr_operations.py | 271 +- ...ackup_resource_vault_configs_operations.py | 273 +- .../operations/_backup_status_operations.py | 111 +- .../_backup_usage_summaries_operations.py | 79 +- .../_backup_workload_items_operations.py | 87 +- .../aio/operations/_backups_operations.py | 150 +- ...e_data_move_operation_result_operations.py | 56 +- ...eleted_protection_containers_operations.py | 147 + ...xport_jobs_operation_results_operations.py | 58 +- .../operations/_feature_support_operations.py | 113 +- ...m_level_recovery_connections_operations.py | 206 +- .../_job_cancellations_operations.py | 54 +- .../aio/operations/_job_details_operations.py | 58 +- .../_job_operation_results_operations.py | 56 +- .../aio/operations/_jobs_operations.py | 52 +- .../aio/operations/_operation_operations.py | 125 +- .../activestamp/aio/operations/_operations.py | 71 +- ..._private_endpoint_connection_operations.py | 328 +- .../_private_endpoint_operations.py | 52 +- .../_protectable_containers_operations.py | 90 +- ...ected_item_operation_results_operations.py | 56 +- ...cted_item_operation_statuses_operations.py | 55 +- .../operations/_protected_items_operations.py | 240 +- ..._container_operation_results_operations.py | 54 +- ...er_refresh_operation_results_operations.py | 57 +- .../_protection_containers_operations.py | 327 +- .../_protection_intent_operations.py | 350 +- .../_protection_policies_operations.py | 271 +- ...ion_policy_operation_results_operations.py | 59 +- ...on_policy_operation_statuses_operations.py | 59 +- .../operations/_recovery_points_operations.py | 129 +- ..._points_recommended_for_move_operations.py | 188 +- ...overy_services_backup_client_operations.py | 591 +- .../_resource_guard_proxies_operations.py | 82 +- .../_resource_guard_proxy_operations.py | 341 +- .../aio/operations/_restores_operations.py | 216 +- .../operations/_security_pins_operations.py | 126 +- .../_validate_operation_operations.py | 182 +- .../_validate_operation_results_operations.py | 56 +- ..._validate_operation_statuses_operations.py | 55 +- .../activestamp/models/__init__.py | 864 +- .../activestamp/models/_models_py3.py | 9486 +++++++++-------- .../_recovery_services_backup_client_enums.py | 255 +- .../activestamp/operations/__init__.py | 107 +- .../operations/_backup_engines_operations.py | 189 +- .../operations/_backup_jobs_operations.py | 116 +- .../_backup_operation_results_operations.py | 93 +- .../_backup_operation_statuses_operations.py | 95 +- .../operations/_backup_policies_operations.py | 126 +- .../_backup_protectable_items_operations.py | 118 +- .../_backup_protected_items_operations.py | 116 +- ...backup_protection_containers_operations.py | 126 +- .../_backup_protection_intent_operations.py | 116 +- ..._resource_encryption_configs_operations.py | 250 +- ...urce_storage_configs_non_crr_operations.py | 405 +- ...ackup_resource_vault_configs_operations.py | 405 +- .../operations/_backup_status_operations.py | 157 +- .../_backup_usage_summaries_operations.py | 116 +- .../_backup_workload_items_operations.py | 130 +- .../operations/_backups_operations.py | 198 +- ...e_data_move_operation_result_operations.py | 95 +- ...eleted_protection_containers_operations.py | 182 + ...xport_jobs_operation_results_operations.py | 97 +- .../operations/_feature_support_operations.py | 159 +- ...m_level_recovery_connections_operations.py | 295 +- .../_job_cancellations_operations.py | 93 +- .../operations/_job_details_operations.py | 97 +- .../_job_operation_results_operations.py | 98 +- .../operations/_jobs_operations.py | 92 +- .../operations/_operation_operations.py | 172 +- .../activestamp/operations/_operations.py | 97 +- ..._private_endpoint_connection_operations.py | 438 +- .../_private_endpoint_operations.py | 91 +- .../_protectable_containers_operations.py | 129 +- ...ected_item_operation_results_operations.py | 97 +- ...cted_item_operation_statuses_operations.py | 96 +- .../operations/_protected_items_operations.py | 354 +- ..._container_operation_results_operations.py | 93 +- ...er_refresh_operation_results_operations.py | 99 +- .../_protection_containers_operations.py | 499 +- .../_protection_intent_operations.py | 490 +- .../_protection_policies_operations.py | 391 +- ...ion_policy_operation_results_operations.py | 101 +- ...on_policy_operation_statuses_operations.py | 101 +- .../operations/_recovery_points_operations.py | 209 +- ..._points_recommended_for_move_operations.py | 238 +- ...overy_services_backup_client_operations.py | 759 +- .../_resource_guard_proxies_operations.py | 122 +- .../_resource_guard_proxy_operations.py | 498 +- .../operations/_restores_operations.py | 270 +- .../operations/_security_pins_operations.py | 175 +- .../_validate_operation_operations.py | 231 +- .../_validate_operation_results_operations.py | 95 +- ..._validate_operation_statuses_operations.py | 94 +- .../passivestamp/__init__.py | 3 +- .../passivestamp/_configuration.py | 42 +- ...recovery_services_backup_passive_client.py | 49 +- .../passivestamp/_serialization.py | 1970 ++++ .../passivestamp/_vendor.py | 6 +- .../passivestamp/aio/__init__.py | 3 +- .../passivestamp/aio/_configuration.py | 44 +- ...recovery_services_backup_passive_client.py | 49 +- .../passivestamp/aio/operations/__init__.py | 25 +- .../operations/_aad_properties_operations.py | 51 +- .../_backup_crr_job_details_operations.py | 109 +- .../operations/_backup_crr_jobs_operations.py | 167 +- .../_backup_protected_items_crr_operations.py | 79 +- ...kup_resource_storage_configs_operations.py | 271 +- .../_backup_usage_summaries_crr_operations.py | 79 +- .../_cross_region_restore_operations.py | 181 +- .../_crr_operation_results_operations.py | 51 +- .../_crr_operation_status_operations.py | 55 +- .../_recovery_points_crr_operations.py | 89 +- .../operations/_recovery_points_operations.py | 161 +- .../passivestamp/models/__init__.py | 368 +- .../passivestamp/models/_models_py3.py | 4104 +++---- ...ry_services_backup_passive_client_enums.py | 111 +- .../passivestamp/operations/__init__.py | 25 +- .../operations/_aad_properties_operations.py | 90 +- .../_backup_crr_job_details_operations.py | 155 +- .../operations/_backup_crr_jobs_operations.py | 210 +- .../_backup_protected_items_crr_operations.py | 116 +- ...kup_resource_storage_configs_operations.py | 405 +- .../_backup_usage_summaries_crr_operations.py | 116 +- .../_cross_region_restore_operations.py | 224 +- .../_crr_operation_results_operations.py | 89 +- .../_crr_operation_status_operations.py | 93 +- .../_recovery_points_crr_operations.py | 132 +- .../operations/_recovery_points_operations.py | 211 +- 150 files changed, 25119 insertions(+), 14710 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/operations/_deleted_protection_containers_operations.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json index 859f2763b759..d203a6e60753 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.9.2", "use": [ - "@autorest/python@5.16.0", - "@autorest/modelerfour@4.19.3" + "@autorest/python@6.1.11", + "@autorest/modelerfour@4.24.3" ], - "commit": "8c6f54ef868240d16aebb269abf56b9a1adf7ecc", + "commit": "276eee1d5dc339bb9413355265f95fa5a92997e1", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --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 d1ee39547054..15cfc033acec 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 @@ -17,7 +17,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['RecoveryServicesBackupClient'] + +__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 8b487b1574bd..00b7712b2c53 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-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-09-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-06-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-09-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/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py index 874f5af8a3a4..ccef3ed973e2 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,73 @@ 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, + DeletedProtectionContainersOperations, + 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 @@ -159,6 +212,9 @@ class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): :ivar backup_protection_containers: BackupProtectionContainersOperations operations :vartype backup_protection_containers: azure.mgmt.recoveryservicesbackup.activestamp.operations.BackupProtectionContainersOperations + :ivar deleted_protection_containers: DeletedProtectionContainersOperations operations + :vartype deleted_protection_containers: + azure.mgmt.recoveryservicesbackup.activestamp.operations.DeletedProtectionContainersOperations :ivar security_pins: SecurityPINsOperations operations :vartype security_pins: azure.mgmt.recoveryservicesbackup.activestamp.operations.SecurityPINsOperations @@ -172,13 +228,13 @@ 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-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-09-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 @@ -192,7 +248,9 @@ 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)} @@ -205,21 +263,15 @@ def __init__( 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_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.operations = Operations( - 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 ) @@ -235,33 +287,21 @@ def __init__( 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_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.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.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.backup_jobs = BackupJobsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.job_details = JobDetailsOperations( - 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 ) @@ -271,15 +311,11 @@ def __init__( 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.jobs = JobsOperations(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.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) self.validate_operation = ValidateOperationOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -289,9 +325,7 @@ def __init__( 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.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 ) @@ -307,9 +341,7 @@ def __init__( 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.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) self.protected_item_operation_statuses = ProtectedItemOperationStatusesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -331,9 +363,10 @@ def __init__( self.backup_protection_containers = BackupProtectionContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.security_pins = SecurityPINsOperations( + self.deleted_protection_containers = DeletedProtectionContainersOperations( 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 ) @@ -344,12 +377,7 @@ def __init__( 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 @@ -358,7 +386,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 000000000000..7c1dedb5133d --- /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.debug( + "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 e871dbadf0e4..378b64967444 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 @@ -14,10 +14,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from msrest import Deserializer, Serializer - 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) @@ -25,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: @@ -32,13 +34,13 @@ 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" 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 2a05ba02d56f..cff2a6c66af2 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 @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['RecoveryServicesBackupClient'] + +__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 0248c8489b34..af13eb36d1fd 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-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-09-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-06-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-09-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/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py index 631c39c6f793..304fb0044a71 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,73 @@ 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, + DeletedProtectionContainersOperations, + 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 @@ -161,6 +214,9 @@ class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): :ivar backup_protection_containers: BackupProtectionContainersOperations operations :vartype backup_protection_containers: azure.mgmt.recoveryservicesbackup.activestamp.aio.operations.BackupProtectionContainersOperations + :ivar deleted_protection_containers: DeletedProtectionContainersOperations operations + :vartype deleted_protection_containers: + azure.mgmt.recoveryservicesbackup.activestamp.aio.operations.DeletedProtectionContainersOperations :ivar security_pins: SecurityPINsOperations operations :vartype security_pins: azure.mgmt.recoveryservicesbackup.activestamp.aio.operations.SecurityPINsOperations @@ -174,13 +230,13 @@ 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-06-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-09-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 @@ -194,7 +250,9 @@ 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)} @@ -207,21 +265,15 @@ def __init__( 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_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.operations = Operations( - 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 ) @@ -237,33 +289,21 @@ def __init__( 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_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.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.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.backup_jobs = BackupJobsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.job_details = JobDetailsOperations( - 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 ) @@ -273,15 +313,11 @@ def __init__( 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.jobs = JobsOperations(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.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) self.validate_operation = ValidateOperationOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -291,9 +327,7 @@ def __init__( 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.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 ) @@ -309,9 +343,7 @@ def __init__( 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.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) self.protected_item_operation_statuses = ProtectedItemOperationStatusesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -333,9 +365,10 @@ def __init__( self.backup_protection_containers = BackupProtectionContainersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.security_pins = SecurityPINsOperations( + self.deleted_protection_containers = DeletedProtectionContainersOperations( 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 ) @@ -346,12 +379,7 @@ def __init__( 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 @@ -360,7 +388,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 index 82cb83982ed0..f398622a7581 100644 --- 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 @@ -14,13 +14,14 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from msrest import Deserializer, Serializer - 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" 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 1d6367eb59cd..619214e67304 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 @@ -51,6 +53,7 @@ from ._protection_policy_operation_statuses_operations import ProtectionPolicyOperationStatusesOperations from ._backup_protectable_items_operations import BackupProtectableItemsOperations from ._backup_protection_containers_operations import BackupProtectionContainersOperations +from ._deleted_protection_containers_operations import DeletedProtectionContainersOperations from ._security_pins_operations import SecurityPINsOperations from ._recovery_points_recommended_for_move_operations import RecoveryPointsRecommendedForMoveOperations from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations @@ -59,56 +62,58 @@ 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", + "DeletedProtectionContainersOperations", + "SecurityPINsOperations", + "RecoveryPointsRecommendedForMoveOperations", + "ResourceGuardProxiesOperations", + "ResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_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 16559a839433..388658cbb85f 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,9 +30,11 @@ from ..._vendor import _convert_request from ...operations._backup_engines_operations import build_get_request, build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupEnginesOperations: """ .. warning:: @@ -44,7 +54,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -53,47 +62,51 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupEngineBaseResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -101,17 +114,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -128,10 +141,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 @@ -141,11 +152,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( @@ -159,43 +168,45 @@ async def get( ) -> _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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupEngineBaseResource] + 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, ) @@ -203,22 +214,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 9199aae3803d..a7de1f6d2e09 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_jobs_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupJobsOperations: """ .. warning:: @@ -43,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -52,45 +61,49 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -98,17 +111,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -125,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 +149,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 410ba78c2b6e..2890668e1029 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._backup_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupOperationResultsOperations: """ .. warning:: @@ -42,14 +51,9 @@ def __init__(self, *args, **kwargs) -> None: 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,37 +63,39 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -97,10 +103,9 @@ async def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -110,5 +115,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 b12706b41696..497f75a2f490 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._backup_operation_statuses_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupOperationStatusesOperations: """ .. warning:: @@ -42,14 +51,9 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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 @@ -57,37 +61,39 @@ async def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -95,22 +101,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 27d2c92bf1b3..2bc517962e6c 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_policies_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupPoliciesOperations: """ .. warning:: @@ -43,53 +53,52 @@ def __init__(self, *args, **kwargs) -> None: 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionPolicyResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -97,16 +106,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -123,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 @@ -136,8 +144,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 a98509df754a..edb2fa1febc0 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_protectable_items_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupProtectableItemsOperations: """ .. warning:: @@ -43,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -52,48 +61,52 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.WorkloadProtectableItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -101,17 +114,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -128,10 +141,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 @@ -141,8 +152,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 94b254aec74e..76aaaeabc53d 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_protected_items_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupProtectedItemsOperations: """ .. warning:: @@ -43,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -52,46 +61,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectedItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -99,17 +112,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -126,10 +139,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 @@ -139,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}/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 0504b253ea3c..d597a030408e 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_protection_containers_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupProtectionContainersOperations: """ .. warning:: @@ -43,51 +53,50 @@ def __init__(self, *args, **kwargs) -> None: 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionContainerResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -95,16 +104,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -121,10 +131,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 +142,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 7171ca277bfd..78b436b7757b 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_protection_intent_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupProtectionIntentOperations: """ .. warning:: @@ -43,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -52,46 +61,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionIntentResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -99,17 +112,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -126,10 +139,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 @@ -139,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}/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 0bd66e70b9c8..53bf41e12b8c 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._backup_resource_encryption_configs_operations import build_get_request, build_update_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupResourceEncryptionConfigsOperations: """ .. warning:: @@ -42,45 +51,43 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] + 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, ) @@ -88,10 +95,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,52 +105,122 @@ 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 - - @distributed_trace_async + @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. + :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. 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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: Union[_models.BackupResourceEncryptionConfigResource, IO], + **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. Is either a model type or a IO type. + Required. + :type parameters: + ~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) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, @@ -153,7 +229,8 @@ 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, ) @@ -161,10 +238,9 @@ async def update( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,5 +251,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 9a4d26fb1f8f..1d7b30198fbd 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,11 +25,17 @@ 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 +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') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupResourceStorageConfigsNonCRROperations: """ .. warning:: @@ -42,44 +55,42 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceConfigResource] + 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, ) @@ -87,10 +98,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,52 +108,120 @@ 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 - @distributed_trace_async + @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. + :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. 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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.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] - _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, @@ -152,7 +230,8 @@ 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, ) @@ -160,10 +239,9 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,52 +249,120 @@ 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 - @distributed_trace_async + @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. + :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. 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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, @@ -225,7 +371,8 @@ 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, ) @@ -233,10 +380,9 @@ async def patch( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -247,5 +393,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 a1c25d10314c..7607449617de 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,11 +25,17 @@ 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 +from ...operations._backup_resource_vault_configs_operations import ( + build_get_request, + build_put_request, + build_update_request, +) from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupResourceVaultConfigsOperations: """ .. warning:: @@ -42,44 +55,42 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceVaultConfigResource] + 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, ) @@ -87,10 +98,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,52 +108,120 @@ 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 - @distributed_trace_async + @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. + :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. 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: Union[_models.BackupResourceVaultConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceVaultConfigResource] + 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, @@ -152,7 +230,8 @@ 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, ) @@ -160,10 +239,9 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,52 +249,120 @@ 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 - @distributed_trace_async + @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. + :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. 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: Union[_models.BackupResourceVaultConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceVaultConfigResource] + 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, @@ -225,7 +371,8 @@ 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, ) @@ -233,10 +380,9 @@ async def put( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -244,12 +390,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 69f52204ded5..36f43943eab6 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._backup_status_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupStatusOperations: """ .. warning:: @@ -42,40 +51,97 @@ def __init__(self, *args, **kwargs) -> None: 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, + *, + 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. + :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: + """ + + @distributed_trace_async + async 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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupStatusResponse] + 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, @@ -83,7 +149,8 @@ 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, ) @@ -91,22 +158,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 7ea15d03c5e0..7199090b351c 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_usage_summaries_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupUsageSummariesOperations: """ .. warning:: @@ -43,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -52,46 +61,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupManagementUsageList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -99,17 +112,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -126,10 +139,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 @@ -139,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}/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 0a20dc1ab042..a45b72f0d787 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._backup_workload_items_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupWorkloadItemsOperations: """ .. warning:: @@ -43,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -54,54 +63,58 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.WorkloadItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -109,19 +122,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -138,10 +149,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 @@ -151,8 +160,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 b98bf19b3ff0..29aa93dfbb5d 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._backups_operations import build_trigger_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BackupsOperations: """ .. warning:: @@ -42,6 +51,83 @@ def __init__(self, *args, **kwargs) -> None: 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,56 +137,70 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, 'BackupRequestResource') + 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, ) @@ -108,10 +208,9 @@ async def trigger( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -121,5 +220,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 ded0bf0c8e2e..776d77218b2a 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._bms_prepare_data_move_operation_result_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class BMSPrepareDataMoveOperationResultOperations: """ .. warning:: @@ -42,50 +51,47 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] + 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, ) @@ -93,10 +99,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -106,12 +111,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/_deleted_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py new file mode 100644 index 000000000000..d7615cd4e478 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._deleted_protection_containers_operations import build_list_request +from .._vendor import MixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DeletedProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.aio.RecoveryServicesBackupClient`'s + :attr:`deleted_protection_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ProtectionContainerResource"]: + """Lists the soft deleted containers registered to Recovery Services Vault. + + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. Required. + :type vault_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 ProtectionContainerResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProtectionContainerResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers"} # 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 61e56e3f8b7c..745270ef522a 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._export_jobs_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ExportJobsOperationResultsOperations: """ .. warning:: @@ -42,51 +51,48 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationResultInfoBaseResource] + 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, ) @@ -94,10 +100,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -105,15 +110,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 51b2fda8fc54..e50e7bc3a5e3 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._feature_support_operations import build_validate_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class FeatureSupportOperations: """ .. warning:: @@ -42,41 +51,100 @@ def __init__(self, *args, **kwargs) -> None: 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, + *, + content_type: str = "application/json", **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. + :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) + :rtype: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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. + + 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) + :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: + """ + + @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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AzureVMResourceFeatureSupportResponse] + 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] - _json = self._serialize.body(parameters, 'FeatureSupportRequest') + 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, @@ -84,7 +152,8 @@ 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, ) @@ -92,22 +161,20 @@ async def validate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 dc6346dfb0e0..a5e019ed35a9 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._item_level_recovery_connections_operations import build_provision_request, build_revoke_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ItemLevelRecoveryConnectionsOperations: """ .. warning:: @@ -42,8 +51,7 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -53,6 +61,8 @@ async def provision( # pylint: disable=inconsistent-return-statements protected_item_name: str, recovery_point_id: str, 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,54 +71,161 @@ 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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -116,10 +233,9 @@ async def provision( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -129,8 +245,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 @@ -147,48 +262,51 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -196,10 +314,9 @@ async def revoke( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -209,5 +326,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 5a6c63f5d59a..5ea2830134e0 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._job_cancellations_operations import build_trigger_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class JobCancellationsOperations: """ .. warning:: @@ -42,49 +51,46 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -92,10 +98,9 @@ async def trigger( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -105,5 +110,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 42b9b8db84b6..492fa260b9c1 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._job_details_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class JobDetailsOperations: """ .. warning:: @@ -42,48 +51,43 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResource] + 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, ) @@ -91,22 +95,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 669fb507126b..e102924db5f7 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._job_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class JobOperationResultsOperations: """ .. warning:: @@ -42,52 +51,49 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -95,10 +101,9 @@ async def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -108,5 +113,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 20cd5fc12855..c71ad10defaf 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_export_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class JobsOperations: """ .. warning:: @@ -42,48 +51,45 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -91,10 +97,9 @@ async def export( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -104,5 +109,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 3bdded3db402..33b20f678bea 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._operation_operations import build_validate_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class OperationOperations: """ .. warning:: @@ -42,43 +51,112 @@ def __init__(self, *args, **kwargs) -> None: 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, + *, + 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. + :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 + 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. + + :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) + :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: + """ + + @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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ValidateOperationsResponse] + 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, @@ -87,7 +165,8 @@ 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, ) @@ -95,22 +174,20 @@ async def validate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 d09b0e50292a..4270ce31ad23 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class Operations: """ .. warning:: @@ -43,37 +53,37 @@ def __init__(self, *args, **kwargs) -> None: 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ClientDiscoveryResponse] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -81,12 +91,17 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -103,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 @@ -116,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': "/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/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py index c94478065087..6a9aad65151c 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,9 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,11 +27,17 @@ 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 +from ...operations._private_endpoint_connection_operations import ( + build_delete_request, + build_get_request, + build_put_request, +) from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointConnectionOperations: """ .. warning:: @@ -44,48 +57,45 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionResource] + 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, ) @@ -93,10 +103,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,47 +113,56 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionResource] + 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] - _json = self._serialize.body(parameters, '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_initial( + 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, ) @@ -152,10 +170,9 @@ async def _put_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,40 +180,123 @@ 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 - @distributed_trace_async + @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. + :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. 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( + self, + vault_name: str, + resource_group_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnectionResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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 @@ -209,20 +309,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -231,66 +328,60 @@ async def begin_put( 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): - 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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -298,10 +389,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -311,25 +401,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. @@ -341,53 +426,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: """ _headers = 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 - 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] + 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( # 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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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 5163c1756dac..1da8d9751673 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._private_endpoint_operations import build_get_operation_status_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class PrivateEndpointOperations: """ .. warning:: @@ -42,7 +51,6 @@ def __init__(self, *args, **kwargs) -> None: 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( self, @@ -56,40 +64,42 @@ async def get_operation_status( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -97,10 +107,9 @@ async def get_operation_status( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,12 +117,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 ae33ce6989bd..b3f168ca6c97 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._protectable_containers_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectableContainersOperations: """ .. warning:: @@ -43,55 +53,53 @@ def __init__(self, *args, **kwargs) -> None: 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectableContainerResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -99,17 +107,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -126,10 +134,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 @@ -139,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}/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 04603641b7e9..8bb9880dbe45 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._protected_item_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectedItemOperationResultsOperations: """ .. warning:: @@ -42,7 +51,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -56,47 +64,49 @@ async def get( ) -> 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ProtectedItemResource]] + 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, ) @@ -104,10 +114,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -116,12 +125,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 7ad6083b6496..0238fe885d44 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._protected_item_operation_statuses_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectedItemOperationStatusesOperations: """ .. warning:: @@ -42,7 +51,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -60,46 +68,49 @@ async def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -107,22 +118,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 c7844b0c2568..33e49ba18fab 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,11 +25,17 @@ 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 +from ...operations._protected_items_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectedItemsOperations: """ .. warning:: @@ -42,7 +55,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -58,46 +70,48 @@ async def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectedItemResource] + 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, ) @@ -105,25 +119,103 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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( @@ -133,7 +225,7 @@ 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]: """Enables backup of an item or to modifies the backup policy information of an already backed up @@ -141,49 +233,63 @@ async def create_or_update( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.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]] - _json = self._serialize.body(parameters, '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, ) @@ -191,10 +297,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -203,15 +308,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 @@ -227,43 +331,45 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -271,10 +377,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -284,5 +389,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 cad7a2deb0d1..e9de72f28655 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._protection_container_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionContainerOperationResultsOperations: """ .. warning:: @@ -42,7 +51,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -55,45 +63,47 @@ async def get( ) -> 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + 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, ) @@ -101,10 +111,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -113,12 +122,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 ab1e891d6ba5..ed2d828e8514 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._protection_container_refresh_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionContainerRefreshOperationResultsOperations: """ .. warning:: @@ -42,53 +51,49 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -96,10 +101,9 @@ async def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -109,5 +113,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 1b287ad81705..464a5a2a879b 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,11 +25,19 @@ 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 +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') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionContainersOperations: """ .. warning:: @@ -42,52 +57,48 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionContainerResource] + 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, ) @@ -95,27 +106,25 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace_async + @overload async def register( self, vault_name: str, @@ -123,6 +132,8 @@ async def register( 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. @@ -130,48 +141,136 @@ async def register( 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. 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 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: + """ + + @distributed_trace_async + async def register( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + parameters: Union[_models.ProtectionContainerResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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 None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource or + None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.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]] - _json = self._serialize.body(parameters, '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, ) @@ -179,10 +278,9 @@ async def register( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -191,65 +289,61 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -257,10 +351,9 @@ async def unregister( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -270,8 +363,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 @@ -288,43 +380,45 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -332,10 +426,9 @@ async def inquire( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -345,57 +438,53 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -403,10 +492,9 @@ async def refresh( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -416,5 +504,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 b677b48617f9..5dc1700fa642 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,11 +25,18 @@ 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 +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') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionIntentOperations: """ .. warning:: @@ -42,12 +56,13 @@ def __init__(self, *args, **kwargs) -> None: 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, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PreValidateEnableBackupResponse: """It will validate followings @@ -64,29 +79,105 @@ 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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async 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) + :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) + :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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PreValidateEnableBackupResponse] + 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] - _json = self._serialize.body(parameters, 'PreValidateEnableBackupRequest') + 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, @@ -94,7 +185,8 @@ 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, ) @@ -102,73 +194,68 @@ async def validate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionIntentResource] + 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, ) @@ -176,27 +263,25 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - - @distributed_trace_async + @overload async def create_or_update( self, vault_name: str, @@ -204,51 +289,133 @@ async def create_or_update( 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. + :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. 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( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + intent_object_name: str, + parameters: Union[_models.ProtectionIntentResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.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] - _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, ) @@ -256,71 +423,66 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -328,10 +490,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -341,5 +502,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 0664c8b0f773..381c9a368c43 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,9 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,11 +27,17 @@ 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 +from ...operations._protection_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionPoliciesOperations: """ .. warning:: @@ -44,50 +57,47 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionPolicyResource] + 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, ) @@ -95,77 +105,155 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace_async + @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. + :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. 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 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: + """ + + @distributed_trace_async + async def create_or_update( + self, + vault_name: str, + resource_group_name: str, + policy_name: str, + parameters: Union[_models.ProtectionPolicyResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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 None or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResource or None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.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]] - _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, ) @@ -173,10 +261,9 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -185,42 +272,39 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -228,10 +312,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -241,27 +324,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. @@ -273,53 +351,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: """ _headers = 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 - 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] + 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( # 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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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 c44e293aa948..1425b1cc1cf0 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._protection_policy_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionPolicyOperationResultsOperations: """ .. warning:: @@ -42,53 +51,49 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionPolicyResource] + 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, ) @@ -96,22 +101,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 6b201ac9f519..ecfe384c3a4b 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._protection_policy_operation_statuses_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ProtectionPolicyOperationStatusesOperations: """ .. warning:: @@ -42,15 +51,9 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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 @@ -58,41 +61,43 @@ async def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -100,22 +105,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 d2e9c7de3b48..9826a03cefcd 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,9 +30,11 @@ from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_request, build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RecoveryPointsOperations: """ .. warning:: @@ -44,7 +54,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -55,52 +64,56 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -108,19 +121,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -137,10 +148,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 @@ -150,11 +159,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( @@ -171,46 +178,50 @@ async def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResource] + 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, ) @@ -218,22 +229,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 cb92e5d15b17..1dc3c7ea6ccf 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,10 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._recovery_points_recommended_for_move_operations import build_list_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RecoveryPointsRecommendedForMoveOperations: """ .. warning:: @@ -43,6 +53,84 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def list( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: _models.ListRecoveryPointsRecommendedForMoveRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable["_models.RecoveryPointResource"]: + """Lists the recovery points recommended for move to another tier. + + :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 parameters: List Recovery points Recommended for Move Request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ListRecoveryPointsRecommendedForMoveRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + 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 + ) -> AsyncIterable["_models.RecoveryPointResource"]: + """Lists the recovery points recommended for move to another tier. + + :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 parameters: List Recovery points Recommended for 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 + :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.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def list( @@ -52,58 +140,74 @@ 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: """ _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', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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") + def prepare_request(next_link=None): if not next_link: - _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, ) @@ -111,21 +215,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -142,10 +242,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 @@ -155,8 +253,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 386614e14d0c..7d3233566fea 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,9 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,54 +27,58 @@ 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 +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') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RecoveryServicesBackupClientOperationsMixin(MixinABC): +class RecoveryServicesBackupClientOperationsMixin(MixinABC): @distributed_trace_async async def get_operation_status( - 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 ) -> _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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -75,10 +86,9 @@ async def get_operation_status( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -86,45 +96,54 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -132,39 +151,112 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 @@ -175,20 +267,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -196,67 +285,73 @@ async def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-st 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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, 'TriggerDataMoveRequest') + 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_initial( + 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, ) @@ -264,39 +359,112 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 @@ -307,20 +475,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -328,37 +493,33 @@ async def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-st 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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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, @@ -368,35 +529,45 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -404,10 +575,9 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -417,11 +587,10 @@ 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 - @distributed_trace_async - async def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements + @overload + async def begin_move_recovery_point( self, vault_name: str, resource_group_name: str, @@ -430,28 +599,33 @@ async def begin_move_recovery_point( # pylint: disable=inconsistent-return-stat 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. + :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. 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 @@ -462,20 +636,115 @@ 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: + """ + + @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( + 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.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. 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. Is either a model type or a IO type. + Required. + :type parameters: + ~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 + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -487,34 +756,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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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 ca7ab6d91350..83a3654f286f 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,11 @@ from ..._vendor import _convert_request from ...operations._resource_guard_proxies_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResourceGuardProxiesOperations: """ .. warning:: @@ -43,47 +53,47 @@ def __init__(self, *args, **kwargs) -> None: 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceGuardProxyBaseResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -91,15 +101,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -116,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 @@ -129,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 - ) - 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 d72dadb09734..2a7e2257faf7 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,11 +25,18 @@ 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 +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') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ResourceGuardProxyOperations: """ .. warning:: @@ -42,48 +56,45 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + 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, ) @@ -91,76 +102,152 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace_async + @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. + :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. 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) + :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: + """ + + @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( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + 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, ) @@ -168,67 +255,63 @@ async def put( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -236,10 +319,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -249,57 +331,132 @@ 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 - @distributed_trace_async + @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. + :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. 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( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, IO], + **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. 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.UnlockDeleteResponse] + 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, ) @@ -307,22 +464,20 @@ async def unlock_delete( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 11b24e5db19c..9d6885219b10 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,9 +6,16 @@ # 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, cast +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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,11 +27,13 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._restores_operations import build_trigger_request_initial +from ...operations._restores_operations import build_trigger_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class RestoresOperations: """ .. warning:: @@ -44,7 +53,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -53,35 +61,45 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -89,10 +107,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -102,11 +119,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, @@ -114,28 +230,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 @@ -146,20 +267,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -171,34 +289,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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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 281cc938ccaf..1f8f597d6f8d 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._security_pins_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SecurityPINsOperations: """ .. warning:: @@ -42,45 +51,113 @@ def __init__(self, *args, **kwargs) -> None: 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, + *, + content_type: str = "application/json", **kwargs: Any ) -> _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: + """ + + @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: + """ + + @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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TokenInformation] + 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] - if parameters is not None: - _json = self._serialize.body(parameters, 'SecurityPinBase') + 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, @@ -89,7 +166,8 @@ 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, ) @@ -97,22 +175,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 7ff561927979..e5cac4307490 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,9 +6,16 @@ # 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, cast +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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,11 +27,13 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._validate_operation_operations import build_trigger_request_initial +from ...operations._validate_operation_operations import build_trigger_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ValidateOperationOperations: """ .. warning:: @@ -44,36 +53,45 @@ def __init__(self, *args, **kwargs) -> None: 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -81,10 +99,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -94,28 +111,68 @@ 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 - @distributed_trace_async - async def begin_trigger( # pylint: disable=inconsistent-return-statements + @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. + :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 + :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 @@ -126,20 +183,53 @@ 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: + """ + + @distributed_trace_async + async def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + 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. 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 + :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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -147,34 +237,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 = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + 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 36761df77f39..fd6f870286c1 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._validate_operation_results_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ValidateOperationResultsOperations: """ .. warning:: @@ -42,50 +51,47 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ValidateOperationsResponse]] + 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, ) @@ -93,10 +99,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -105,12 +110,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 0cf24fcb2b9e..83d352317c7e 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +27,11 @@ from ..._vendor import _convert_request from ...operations._validate_operation_statuses_operations import build_get_request from .._vendor import MixinABC -T = TypeVar('T') + +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ValidateOperationStatusesOperations: """ .. warning:: @@ -42,14 +51,9 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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 @@ -57,37 +61,40 @@ async def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -95,22 +102,20 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 917c60c8ab23..35ce2a2fac75 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 @@ -302,442 +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, - 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, -) +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', - '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', + "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() \ No newline at end of file +_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 fe48e1d191bf..a50b57daef0b 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. @@ -9,45 +10,43 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from .. import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + 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] @@ -56,33 +55,30 @@ 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. @@ -90,7 +86,7 @@ class ProtectionContainer(msrest.serialization.Model): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -98,17 +94,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -117,20 +113,28 @@ class ProtectionContainer(msrest.serialization.Model): """ _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__( @@ -148,7 +152,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -160,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 @@ -169,11 +173,11 @@ 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. @@ -181,7 +185,7 @@ class DpmContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -189,17 +193,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -210,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. @@ -225,29 +229,27 @@ 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, @@ -272,7 +274,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -288,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. @@ -301,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 @@ -313,7 +322,7 @@ 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. @@ -322,7 +331,7 @@ class AzureBackupServerContainer(DpmContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -330,17 +339,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -351,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. @@ -366,24 +375,24 @@ 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__( @@ -409,7 +418,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -425,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. @@ -438,15 +447,30 @@ 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. @@ -454,7 +478,7 @@ class BackupEngineBase(msrest.serialization.Model): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the backup engine. 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 registration_status: Registration status of the backup engine with the Recovery Services @@ -465,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. Known - values are: "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 @@ -488,27 +512,30 @@ 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__( @@ -533,7 +560,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the backup engine. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -561,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 @@ -577,7 +604,7 @@ 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. @@ -586,7 +613,7 @@ class AzureBackupServerEngine(BackupEngineBase): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the backup engine. 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 registration_status: Registration status of the backup engine with the Recovery Services @@ -597,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. Known - values are: "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 @@ -620,23 +647,23 @@ 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__( @@ -661,7 +688,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the backup engine. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -689,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] @@ -733,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). @@ -742,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. @@ -778,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "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__( @@ -821,11 +861,11 @@ def __init__( :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", "ProtectionFailed". + "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] @@ -842,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "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 @@ -857,24 +897,24 @@ class AzureFileShareProtectableItem(WorkloadProtectableItem): belongs. :vartype parent_container_friendly_name: str :ivar azure_file_share_type: File Share type XSync or XSMB. Known values are: "Invalid", - "XSMB", "XSync". + "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__( @@ -897,7 +937,7 @@ def __init__( :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", "ProtectionFailed". + "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 @@ -907,38 +947,45 @@ def __init__( item belongs. :paramtype parent_container_friendly_name: str :keyword azure_file_share_type: File Share type XSync or XSMB. Known values are: "Invalid", - "XSMB", "XSync". + "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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -953,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. Known values are: "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 @@ -975,36 +1022,47 @@ class ProtectedItem(msrest.serialization.Model): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int """ _validation = { - '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_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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, } _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__( @@ -1024,6 +1082,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, **kwargs ): """ @@ -1039,7 +1098,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. Known values are: "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 @@ -1062,8 +1121,10 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int """ - super(ProtectedItem, self).__init__(**kwargs) + super().__init__(**kwargs) self.protected_item_type = None # type: Optional[str] self.backup_management_type = None self.workload_type = None @@ -1081,26 +1142,27 @@ def __init__( self.resource_guard_operation_requests = resource_guard_operation_requests self.is_archive_enabled = is_archive_enabled self.policy_name = policy_name + self.soft_delete_retention_period = soft_delete_retention_period -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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -1115,7 +1177,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. Known values are: "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 @@ -1137,12 +1199,14 @@ class AzureFileshareProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of the fileshare represented by this backup item. :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -1158,39 +1222,40 @@ class AzureFileshareProtectedItem(ProtectedItem): """ _validation = { - '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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, *, container_name: Optional[str] = None, @@ -1207,6 +1272,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, friendly_name: Optional[str] = None, protection_status: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, @@ -1229,7 +1295,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. Known values are: "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 @@ -1252,12 +1318,14 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword friendly_name: Friendly name of the fileshare represented by this backup item. :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -1271,8 +1339,25 @@ def __init__( :paramtype extended_info: ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureFileshareProtectedItemExtendedInfo """ - super(AzureFileshareProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + **kwargs + ) + self.protected_item_type = "AzureFileShareProtectedItem" # type: str self.friendly_name = friendly_name self.protection_status = protection_status self.protection_state = protection_state @@ -1282,7 +1367,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. @@ -1302,16 +1387,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__( @@ -1332,7 +1417,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 @@ -1340,35 +1425,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__( @@ -1384,7 +1477,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 @@ -1397,15 +1490,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. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase", "SAPHanaDBInstance". + "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. @@ -1419,17 +1512,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__( @@ -1451,7 +1544,7 @@ def __init__( :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", "SAPHanaDBInstance". + "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. @@ -1464,46 +1557,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] @@ -1512,8 +1608,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 @@ -1522,66 +1618,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] @@ -1590,8 +1682,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. @@ -1605,15 +1697,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__( @@ -1636,46 +1728,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] @@ -1684,20 +1776,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. Known values are: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + "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). Known values - are: "Invalid", "FullShareRestore", "ItemLevelRestore". + 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 @@ -1710,17 +1802,17 @@ 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__( @@ -1736,17 +1828,17 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. Known values are: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + "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). Known - values are: "Invalid", "FullShareRestore", "ItemLevelRestore". + 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 @@ -1757,8 +1849,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 @@ -1770,8 +1862,8 @@ 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. @@ -1779,7 +1871,7 @@ class IaaSVMContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -1787,17 +1879,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -1814,23 +1906,26 @@ 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__( @@ -1851,7 +1946,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -1871,8 +1966,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 @@ -1887,7 +1989,7 @@ class AzureIaaSClassicComputeVMContainer(IaaSVMContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -1895,17 +1997,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -1922,19 +2024,19 @@ 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__( @@ -1955,7 +2057,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -1975,15 +2077,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. @@ -1991,12 +2103,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "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. @@ -2009,22 +2121,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__( @@ -2047,7 +2162,7 @@ def __init__( :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", "ProtectionFailed". + "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. @@ -2058,8 +2173,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 @@ -2074,12 +2195,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "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. @@ -2092,18 +2213,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__( @@ -2126,7 +2247,7 @@ def __init__( :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", "ProtectionFailed". + "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. @@ -2137,31 +2258,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -2176,7 +2306,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. Known values are: "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 @@ -2198,6 +2328,8 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of the VM represented by this backup item. :vartype friendly_name: str :ivar virtual_machine_id: Fully qualified ARM ID of the virtual machine represented by this @@ -2206,11 +2338,11 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -2234,53 +2366,57 @@ class AzureIaaSVMProtectedItem(ProtectedItem): """ _validation = { - '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'}, + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, *, container_name: Optional[str] = None, @@ -2297,6 +2433,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, protection_status: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, @@ -2319,7 +2456,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. Known values are: "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 @@ -2342,10 +2479,12 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword health_details: Health details on this backup item. @@ -2363,8 +2502,25 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ExtendedProperties """ - super(AzureIaaSVMProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + **kwargs + ) + self.protected_item_type = "AzureIaaSVMProtectedItem" # type: str self.friendly_name = None self.virtual_machine_id = None self.protection_status = protection_status @@ -2379,24 +2535,24 @@ 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. 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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -2411,7 +2567,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. Known values are: "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 @@ -2433,6 +2589,8 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of the VM represented by this backup item. :vartype friendly_name: str :ivar virtual_machine_id: Fully qualified ARM ID of the virtual machine represented by this @@ -2441,11 +2599,11 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -2469,49 +2627,50 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): """ _validation = { - '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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, *, container_name: Optional[str] = None, @@ -2528,6 +2687,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, protection_status: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, @@ -2550,7 +2710,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. Known values are: "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 @@ -2573,10 +2733,12 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword health_details: Health details on this backup item. @@ -2594,8 +2756,32 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ExtendedProperties """ - super(AzureIaaSClassicComputeVMProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + 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): @@ -2607,7 +2793,7 @@ class AzureIaaSComputeVMContainer(IaaSVMContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -2615,17 +2801,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -2642,19 +2828,19 @@ 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__( @@ -2675,7 +2861,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -2695,8 +2881,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): @@ -2708,12 +2904,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "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. @@ -2726,18 +2922,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__( @@ -2760,7 +2956,7 @@ def __init__( :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", "ProtectionFailed". + "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. @@ -2771,28 +2967,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -2807,7 +3012,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. Known values are: "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 @@ -2829,6 +3034,8 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of the VM represented by this backup item. :vartype friendly_name: str :ivar virtual_machine_id: Fully qualified ARM ID of the virtual machine represented by this @@ -2837,11 +3044,11 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -2865,49 +3072,50 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): """ _validation = { - '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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, *, container_name: Optional[str] = None, @@ -2924,6 +3132,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, protection_status: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, health_details: Optional[List["_models.AzureIaaSVMHealthDetails"]] = None, @@ -2946,7 +3155,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. Known values are: "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 @@ -2969,10 +3178,12 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "IRPending", "Protected", "ProtectionError", "ProtectionStopped", and "ProtectionPaused". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionState :keyword health_details: Health details on this backup item. @@ -2990,11 +3201,35 @@ def __init__( :paramtype extended_properties: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ExtendedProperties """ - super(AzureIaaSComputeVMProtectedItem, self).__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(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, + soft_delete_retention_period=soft_delete_retention_period, + 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. @@ -3010,33 +3245,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. @@ -3052,26 +3283,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 @@ -3094,33 +3321,29 @@ 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. @@ -3128,7 +3351,7 @@ class Job(msrest.serialization.Model): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -3141,28 +3364,36 @@ 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__( @@ -3183,7 +3414,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3197,7 +3428,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 @@ -3208,7 +3439,7 @@ 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. @@ -3217,7 +3448,7 @@ class AzureIaaSVMJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -3230,8 +3461,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 @@ -3254,25 +3485,25 @@ 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__( @@ -3300,7 +3531,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3332,8 +3563,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 @@ -3343,7 +3583,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. @@ -3363,12 +3603,12 @@ 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__( @@ -3398,7 +3638,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 @@ -3407,7 +3647,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. @@ -3430,14 +3670,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__( @@ -3472,7 +3712,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 @@ -3483,7 +3723,7 @@ 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. @@ -3492,7 +3732,7 @@ class AzureIaaSVMJobV2(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -3505,8 +3745,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 @@ -3527,24 +3767,24 @@ 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__( @@ -3571,7 +3811,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3601,8 +3841,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 @@ -3611,7 +3860,7 @@ 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 across all @@ -3634,12 +3883,12 @@ class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - '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'}, + "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__( @@ -3672,7 +3921,7 @@ def __init__( 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 @@ -3688,8 +3937,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] @@ -3711,26 +3960,26 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): :ivar time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". :vartype time_zone: str - :ivar policy_type: Known values are: "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'}, - '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'}, + "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__( @@ -3771,12 +4020,16 @@ def __init__( :keyword time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific Standard Time". :paramtype time_zone: str - :keyword policy_type: Known values are: "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 @@ -3786,23 +4039,24 @@ def __init__( 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. Known values are: "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. 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 source_resource_id: ARM ID of the resource to be backed up. @@ -3813,26 +4067,30 @@ class ProtectionIntent(msrest.serialization.Model): :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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__( @@ -3848,7 +4106,7 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -3859,11 +4117,11 @@ def __init__( :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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 @@ -3875,20 +4133,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. Known values are: "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. 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 source_resource_id: ARM ID of the resource to be backed up. @@ -3899,26 +4157,26 @@ class AzureRecoveryServiceVaultProtectionIntent(ProtectionIntent): :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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__( @@ -3934,7 +4192,7 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -3945,12 +4203,19 @@ def __init__( :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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): @@ -3958,15 +4223,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. Known values are: "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. 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 source_resource_id: ARM ID of the resource to be backed up. @@ -3977,7 +4242,7 @@ class AzureResourceProtectionIntent(ProtectionIntent): :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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. @@ -3985,17 +4250,17 @@ 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__( @@ -4012,7 +4277,7 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -4023,22 +4288,29 @@ def __init__( :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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. @@ -4046,7 +4318,7 @@ class AzureWorkloadContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -4054,17 +4326,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -4081,34 +4353,38 @@ class AzureWorkloadContainer(ProtectionContainer): :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar operation_type: Re-Do Operation. Known values are: "Invalid", "Register", "Reregister". + :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__( @@ -4131,7 +4407,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -4153,16 +4429,23 @@ def __init__( :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword operation_type: Re-Do Operation. Known values are: "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 @@ -4170,7 +4453,9 @@ 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. @@ -4179,7 +4464,7 @@ class AzureSQLAGWorkloadContainerProtectionContainer(AzureWorkloadContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -4187,17 +4472,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -4214,30 +4499,31 @@ class AzureSQLAGWorkloadContainerProtectionContainer(AzureWorkloadContainer): :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar operation_type: Re-Do Operation. Known values are: "Invalid", "Register", "Reregister". + :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__( @@ -4260,7 +4546,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -4282,16 +4568,28 @@ def __init__( :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword operation_type: Re-Do Operation. Known values are: "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): @@ -4303,7 +4601,7 @@ class AzureSqlContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -4311,17 +4609,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -4330,16 +4628,16 @@ class AzureSqlContainer(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'}, + "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__( @@ -4357,7 +4655,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -4369,28 +4667,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -4405,7 +4710,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. Known values are: "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 @@ -4427,11 +4732,13 @@ class AzureSqlProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -4440,32 +4747,33 @@ class AzureSqlProtectedItem(ProtectedItem): """ _validation = { - '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'}, + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "protected_item_data_id": {"key": "protectedItemDataId", "type": "str"}, + "protection_state": {"key": "protectionState", "type": "str"}, + "extended_info": {"key": "extendedInfo", "type": "AzureSqlProtectedItemExtendedInfo"}, } def __init__( @@ -4485,6 +4793,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, protected_item_data_id: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectedItemState"]] = None, extended_info: Optional["_models.AzureSqlProtectedItemExtendedInfo"] = None, @@ -4503,7 +4812,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. Known values are: "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 @@ -4526,25 +4835,44 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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__(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, + soft_delete_retention_period=soft_delete_retention_period, + **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. @@ -4556,9 +4884,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__( @@ -4578,7 +4906,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 @@ -4591,8 +4919,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] @@ -4602,14 +4930,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__( @@ -4629,12 +4957,16 @@ 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. @@ -4643,7 +4975,7 @@ class AzureStorageContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -4651,17 +4983,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -4674,29 +5006,29 @@ 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. Known values are: "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__( @@ -4719,7 +5051,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -4737,14 +5069,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. Known values are: "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 @@ -4752,7 +5091,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. @@ -4764,9 +5103,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__( @@ -4785,13 +5124,13 @@ 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. @@ -4800,7 +5139,7 @@ class AzureStorageJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -4813,8 +5152,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 @@ -4837,25 +5176,25 @@ 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__( @@ -4883,7 +5222,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -4915,8 +5254,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 @@ -4926,7 +5274,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. @@ -4939,9 +5287,9 @@ 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__( @@ -4961,13 +5309,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. @@ -4977,33 +5325,27 @@ 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. @@ -5011,20 +5353,19 @@ class ProtectableContainer(msrest.serialization.Model): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 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. Known values are: "Invalid", "Unknown", "IaasVMContainer", "IaasVMServiceContainer", - "DPMContainer", "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", - "Windows", "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", - "GenericContainer", "Microsoft.ClassicCompute/virtualMachines", - "Microsoft.Compute/virtualMachines", "AzureWorkloadContainer". + #. 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.ProtectableContainerType :ivar health_status: Status of health of the container. @@ -5034,19 +5375,22 @@ 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__( @@ -5063,7 +5407,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword health_status: Status of health of the container. @@ -5071,7 +5415,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] @@ -5088,20 +5432,19 @@ class AzureStorageProtectableContainer(ProtectableContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 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. Known values are: "Invalid", "Unknown", "IaasVMContainer", "IaasVMServiceContainer", - "DPMContainer", "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", - "Windows", "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", - "GenericContainer", "Microsoft.ClassicCompute/virtualMachines", - "Microsoft.Compute/virtualMachines", "AzureWorkloadContainer". + #. 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.ProtectableContainerType :ivar health_status: Status of health of the container. @@ -5111,15 +5454,15 @@ 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__( @@ -5136,7 +5479,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword health_status: Status of health of the container. @@ -5144,8 +5487,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): @@ -5157,20 +5506,19 @@ class AzureVMAppContainerProtectableContainer(ProtectableContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 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. Known values are: "Invalid", "Unknown", "IaasVMContainer", "IaasVMServiceContainer", - "DPMContainer", "AzureBackupServerContainer", "MABContainer", "Cluster", "AzureSqlContainer", - "Windows", "VCenter", "VMAppContainer", "SQLAGWorkLoadContainer", "StorageContainer", - "GenericContainer", "Microsoft.ClassicCompute/virtualMachines", - "Microsoft.Compute/virtualMachines", "AzureWorkloadContainer". + #. 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.ProtectableContainerType :ivar health_status: Status of health of the container. @@ -5180,15 +5528,15 @@ 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__( @@ -5205,7 +5553,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword health_status: Status of health of the container. @@ -5213,11 +5561,17 @@ 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. @@ -5226,7 +5580,7 @@ class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -5234,17 +5588,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -5261,30 +5615,31 @@ class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :ivar operation_type: Re-Do Operation. Known values are: "Invalid", "Register", "Reregister". + :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__( @@ -5307,7 +5662,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -5329,16 +5684,28 @@ def __init__( :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType - :keyword operation_type: Re-Do Operation. Known values are: "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): @@ -5346,7 +5713,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 @@ -5355,68 +5722,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. Known values are: "Invalid", "Supported", - "DefaultOFF", "DefaultON", "NotSupported". + "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, "_models.SupportStatus"]] = None, - **kwargs - ): + def __init__(self, *, support_status: Optional[Union[str, "_models.SupportStatus"]] = None, **kwargs): """ :keyword support_status: Support status of feature. Known values are: "Invalid", "Supported", - "DefaultOFF", "DefaultON", "NotSupported". + "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. @@ -5424,31 +5780,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "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, @@ -5467,11 +5821,11 @@ def __init__( :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", "ProtectionFailed". + "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] @@ -5482,8 +5836,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. @@ -5491,12 +5847,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -5512,24 +5868,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__( @@ -5554,7 +5917,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -5568,8 +5931,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 @@ -5577,11 +5946,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, AzureVmWorkloadSAPHanaDBInstance, AzureVmWorkloadSAPHanaDatabaseProtectableItem, AzureVmWorkloadSAPHanaHSR, 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. @@ -5589,12 +5962,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -5619,27 +5992,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', 'SAPHanaDBInstance': 'AzureVmWorkloadSAPHanaDBInstance', 'SAPHanaDatabase': 'AzureVmWorkloadSAPHanaDatabaseProtectableItem', 'SAPHanaHSR': 'AzureVmWorkloadSAPHanaHSR', '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__( @@ -5667,7 +6049,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -5690,8 +6072,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 @@ -5702,27 +6090,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, AzureVmWorkloadSAPHanaDBInstanceProtectedItem, 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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -5737,7 +6126,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. Known values are: "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 @@ -5759,6 +6148,8 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :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. @@ -5771,11 +6162,11 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :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", "ProtectionPaused". + "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", "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. @@ -5786,7 +6177,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. Known values are: "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 @@ -5799,51 +6190,57 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): """ _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}'}, + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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', 'AzureVmWorkloadSAPHanaDBInstance': 'AzureVmWorkloadSAPHanaDBInstanceProtectedItem', '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, *, container_name: Optional[str] = None, @@ -5860,6 +6257,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, @@ -5886,7 +6284,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. Known values are: "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 @@ -5909,6 +6307,8 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :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. @@ -5917,11 +6317,11 @@ def __init__( distributed. :paramtype parent_type: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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", "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. @@ -5933,7 +6333,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -5943,8 +6343,25 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + **kwargs + ) + self.protected_item_type = "AzureVmWorkloadProtectedItem" # type: str self.friendly_name = None self.server_name = server_name self.parent_name = parent_name @@ -5960,7 +6377,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 across all @@ -5986,13 +6403,13 @@ class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): """ _attribute_map = { - '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'}, + "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__( @@ -6029,7 +6446,7 @@ 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 @@ -6046,15 +6463,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. Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", - "SAPAseDatabase", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype work_load_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :ivar settings: Common settings for the backup management. @@ -6068,17 +6485,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__( @@ -6100,7 +6517,7 @@ def __init__( :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype work_load_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :keyword settings: Common settings for the backup management. @@ -6112,32 +6529,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -6152,7 +6575,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. Known values are: "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 @@ -6174,6 +6597,8 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :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. @@ -6186,11 +6611,11 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :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", "ProtectionPaused". + "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", "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. @@ -6201,7 +6626,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. Known values are: "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 @@ -6214,47 +6639,48 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, @@ -6271,6 +6697,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, @@ -6297,7 +6724,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. Known values are: "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 @@ -6320,6 +6747,8 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :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. @@ -6328,11 +6757,11 @@ def __init__( distributed. :paramtype parent_type: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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", "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. @@ -6344,7 +6773,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -6354,8 +6783,36 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPAseDatabaseProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + 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): @@ -6367,12 +6824,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6388,20 +6845,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__( @@ -6426,7 +6883,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6440,11 +6897,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. @@ -6453,12 +6923,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6483,23 +6953,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__( @@ -6527,7 +6997,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6550,8 +7020,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): @@ -6563,12 +7047,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6584,20 +7068,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__( @@ -6622,7 +7106,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6636,11 +7120,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. @@ -6649,12 +7146,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -6679,23 +7176,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__( @@ -6723,7 +7220,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -6746,28 +7243,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -6782,7 +7295,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. Known values are: "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 @@ -6804,6 +7317,8 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :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. @@ -6816,11 +7331,11 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :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", "ProtectionPaused". + "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", "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. @@ -6831,7 +7346,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. Known values are: "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 @@ -6844,47 +7359,48 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, @@ -6901,6 +7417,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, @@ -6927,7 +7444,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. Known values are: "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 @@ -6950,6 +7467,8 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :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. @@ -6958,11 +7477,11 @@ def __init__( distributed. :paramtype parent_type: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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", "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. @@ -6974,7 +7493,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -6984,8 +7503,36 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPHanaDatabaseProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + 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): @@ -6997,12 +7544,12 @@ 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. + :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", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7018,20 +7565,20 @@ class AzureVmWorkloadSAPHanaDatabaseWorkloadItem(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__( @@ -7056,7 +7603,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7070,11 +7617,22 @@ 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(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 AzureVmWorkloadSAPHanaDBInstance(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 = "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. @@ -7083,12 +7641,12 @@ class AzureVmWorkloadSAPHanaDBInstance(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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7113,23 +7671,23 @@ class AzureVmWorkloadSAPHanaDBInstance(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__( @@ -7157,7 +7715,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7180,28 +7738,44 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSAPHanaDBInstance, 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 = 'SAPHanaDBInstance' # type: str - - -class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(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 = "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: 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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -7216,7 +7790,7 @@ class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(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. Known values are: "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 @@ -7238,6 +7812,8 @@ class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(AzureVmWorkloadProtectedItem :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :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. @@ -7250,11 +7826,11 @@ class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(AzureVmWorkloadProtectedItem :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", "ProtectionPaused". + "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", "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. @@ -7265,7 +7841,7 @@ class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(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. Known values are: "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 @@ -7278,47 +7854,48 @@ class AzureVmWorkloadSAPHanaDBInstanceProtectedItem(AzureVmWorkloadProtectedItem """ _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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, @@ -7335,6 +7912,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, @@ -7361,7 +7939,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. Known values are: "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 @@ -7384,6 +7962,8 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :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. @@ -7392,11 +7972,11 @@ def __init__( distributed. :paramtype parent_type: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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", "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. @@ -7408,7 +7988,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -7418,11 +7998,39 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSAPHanaDBInstanceProtectedItem, self).__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): + 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, + soft_delete_retention_period=soft_delete_retention_period, + 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. @@ -7431,12 +8039,12 @@ class AzureVmWorkloadSAPHanaHSR(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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7461,23 +8069,23 @@ class AzureVmWorkloadSAPHanaHSR(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__( @@ -7505,7 +8113,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7528,11 +8136,27 @@ def __init__( :paramtype prebackupvalidation: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreBackupValidation """ - super(AzureVmWorkloadSAPHanaHSR, 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 = 'SAPHanaHSR' # 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. @@ -7541,12 +8165,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7571,23 +8195,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__( @@ -7615,7 +8239,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7638,8 +8262,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): @@ -7651,12 +8289,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7672,20 +8310,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__( @@ -7710,7 +8348,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7724,11 +8362,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. @@ -7737,12 +8388,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7767,23 +8418,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__( @@ -7811,7 +8462,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7834,11 +8485,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. @@ -7847,12 +8514,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -7877,23 +8544,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__( @@ -7921,7 +8588,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -7944,28 +8611,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -7980,7 +8663,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. Known values are: "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 @@ -8002,6 +8685,8 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :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. @@ -8014,11 +8699,11 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :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", "ProtectionPaused". + "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", "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. @@ -8029,7 +8714,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. Known values are: "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 @@ -8042,47 +8727,48 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): """ _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__( + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, @@ -8099,6 +8785,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, server_name: Optional[str] = None, parent_name: Optional[str] = None, parent_type: Optional[str] = None, @@ -8125,7 +8812,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. Known values are: "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 @@ -8148,6 +8835,8 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :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. @@ -8156,11 +8845,11 @@ def __init__( distributed. :paramtype parent_type: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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", "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. @@ -8172,7 +8861,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -8182,8 +8871,36 @@ def __init__( :paramtype kpis_healths: dict[str, ~azure.mgmt.recoveryservicesbackup.activestamp.models.KPIResourceHealthDetails] """ - super(AzureVmWorkloadSQLDatabaseProtectedItem, self).__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 + 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, + soft_delete_retention_period=soft_delete_retention_period, + 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): @@ -8195,12 +8912,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -8216,20 +8933,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__( @@ -8254,7 +8971,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -8268,11 +8985,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. @@ -8281,12 +9011,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -8311,23 +9041,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__( @@ -8355,7 +9085,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -8378,11 +9108,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. @@ -8391,12 +9135,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. Known values are: "Invalid", "NotProtected", - "Protecting", "Protected", "ProtectionFailed". + "Protecting", "Protected", and "ProtectionFailed". :vartype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :ivar parent_name: Name for instance or AG. @@ -8415,21 +9159,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__( @@ -8455,7 +9199,7 @@ def __init__( :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", "ProtectionFailed". + "NotProtected", "Protecting", "Protected", and "ProtectionFailed". :paramtype protection_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus :keyword parent_name: Name for instance or AG. @@ -8472,28 +9216,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. Known values are: "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. 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 source_resource_id: ARM ID of the resource to be backed up. @@ -8504,26 +9259,26 @@ class AzureWorkloadAutoProtectionIntent(AzureRecoveryServiceVaultProtectionInten :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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__( @@ -8539,7 +9294,7 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -8550,12 +9305,19 @@ def __init__( :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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): @@ -8563,12 +9325,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. Known values are: "Invalid", "Full", "Differential", "Log", "CopyOnlyFull", "Incremental", "SnapshotFull", - "SnapshotCopyOnlyFull". + and "SnapshotCopyOnlyFull". :vartype backup_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupType :ivar enable_compression: Bool for Compression setting. :vartype enable_compression: bool @@ -8578,14 +9340,14 @@ 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__( @@ -8599,7 +9361,7 @@ def __init__( """ :keyword backup_type: Type of backup, viz. Full, Differential, Log or CopyOnlyFull. Known values are: "Invalid", "Full", "Differential", "Log", "CopyOnlyFull", "Incremental", - "SnapshotFull", "SnapshotCopyOnlyFull". + "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 @@ -8607,8 +9369,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 @@ -8619,15 +9381,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. Known values are: "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. 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 source_resource_id: ARM ID of the resource to be backed up. @@ -8638,22 +9400,22 @@ class AzureWorkloadContainerAutoProtectionIntent(ProtectionIntent): :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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__( @@ -8669,7 +9431,7 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -8680,15 +9442,22 @@ def __init__( :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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 @@ -8702,9 +9471,9 @@ 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__( @@ -8725,13 +9494,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. @@ -8747,11 +9516,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__( @@ -8776,7 +9545,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 @@ -8784,7 +9553,7 @@ 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. @@ -8793,7 +9562,7 @@ class AzureWorkloadJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -8806,8 +9575,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 @@ -8825,23 +9594,23 @@ 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__( @@ -8867,7 +9636,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -8894,8 +9663,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 @@ -8903,7 +9681,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. @@ -8916,9 +9694,9 @@ 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__( @@ -8938,13 +9716,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. @@ -8954,24 +9732,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 @@ -8979,18 +9751,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9001,19 +9774,26 @@ 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__( @@ -9029,7 +9809,7 @@ def __init__( :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. Known values are: "Invalid", "Full", "Log", - "Differential", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9038,8 +9818,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 @@ -9049,18 +9829,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9074,20 +9854,23 @@ 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__( @@ -9104,7 +9887,7 @@ def __init__( :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. Known values are: "Invalid", "Full", "Log", - "Differential", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9116,24 +9899,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9144,7 +9934,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. Known values are: "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 @@ -9154,21 +9944,25 @@ 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__( @@ -9184,7 +9978,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9195,7 +9989,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. Known values are: "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 @@ -9203,8 +9997,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 @@ -9218,11 +10012,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9233,7 +10027,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. Known values are: "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 @@ -9245,18 +10039,18 @@ 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__( @@ -9273,7 +10067,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9284,7 +10078,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. Known values are: "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 @@ -9294,8 +10088,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 @@ -9304,13 +10106,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9324,16 +10126,19 @@ 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__( @@ -9350,7 +10155,7 @@ def __init__( :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. Known values are: "Invalid", "Full", "Log", - "Differential", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9362,23 +10167,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9389,7 +10201,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. Known values are: "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 @@ -9399,21 +10211,24 @@ 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__( @@ -9429,7 +10244,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9440,7 +10255,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. Known values are: "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 @@ -9448,23 +10263,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9475,7 +10298,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. Known values are: "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 @@ -9487,22 +10310,24 @@ 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__( @@ -9519,7 +10344,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9530,7 +10355,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. Known values are: "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 @@ -9540,8 +10365,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 @@ -9550,11 +10383,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9565,7 +10398,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. Known values are: "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 @@ -9580,19 +10413,22 @@ 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__( @@ -9610,7 +10446,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9621,7 +10457,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. Known values are: "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 @@ -9634,8 +10470,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 @@ -9644,13 +10489,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9661,15 +10506,18 @@ 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__( @@ -9685,7 +10533,7 @@ def __init__( :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. Known values are: "Invalid", "Full", "Log", - "Differential", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9694,8 +10542,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): @@ -9703,11 +10557,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9718,7 +10572,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. Known values are: "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 @@ -9731,18 +10585,21 @@ 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__( @@ -9759,7 +10616,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -9770,7 +10627,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. Known values are: "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 @@ -9781,8 +10638,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 @@ -9791,15 +10656,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. Known values are: "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. 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 source_resource_id: ARM ID of the resource to be backed up. @@ -9810,28 +10675,28 @@ class AzureWorkloadSQLAutoProtectionIntent(AzureWorkloadAutoProtectionIntent): :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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. Known values are: "Invalid", "SQLInstance", "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", - "SAPAseSystem", "SAPAseDatabase", "SAPHanaDBInstance". + "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__( @@ -9848,7 +10713,7 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -9859,35 +10724,42 @@ def __init__( :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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. Known values are: "Invalid", "SQLInstance", "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", - "SAPAseSystem", "SAPAseDatabase", "SAPHanaDBInstance". + "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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9904,20 +10776,23 @@ 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__( @@ -9934,7 +10809,7 @@ def __init__( :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. Known values are: "Invalid", "Full", "Log", - "Differential", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9949,8 +10824,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 @@ -9959,13 +10840,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -9985,17 +10866,20 @@ 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__( @@ -10013,7 +10897,7 @@ def __init__( :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. Known values are: "Invalid", "Full", "Log", - "Differential", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -10031,24 +10915,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10059,7 +10950,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. Known values are: "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 @@ -10078,24 +10969,27 @@ 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__( @@ -10114,7 +11008,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10125,7 +11019,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. Known values are: "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 @@ -10142,26 +11036,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10172,7 +11076,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. Known values are: "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 @@ -10193,25 +11097,27 @@ 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__( @@ -10231,7 +11137,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10242,7 +11148,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. Known values are: "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 @@ -10261,21 +11167,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10286,7 +11205,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. Known values are: "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 @@ -10310,22 +11229,25 @@ 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__( @@ -10346,7 +11268,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10357,7 +11279,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. Known values are: "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 @@ -10379,12 +11301,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. @@ -10395,8 +11329,8 @@ 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__( @@ -10413,21 +11347,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10438,7 +11374,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. Known values are: "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 @@ -10460,21 +11396,24 @@ 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__( @@ -10494,7 +11433,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -10505,7 +11444,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. Known values are: "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 @@ -10525,12 +11464,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. @@ -10544,25 +11494,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__( @@ -10576,12 +11526,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 @@ -10604,7 +11554,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 @@ -10613,19 +11563,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__( @@ -10640,18 +11590,18 @@ 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 :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 @@ -10660,21 +11610,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 @@ -10690,8 +11635,8 @@ 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__( @@ -10709,11 +11654,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. @@ -10735,14 +11680,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__( @@ -10776,7 +11721,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 @@ -10787,31 +11732,31 @@ 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. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond". + "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__( @@ -10827,20 +11772,20 @@ def __init__( ): """ :keyword unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond". + "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 @@ -10849,7 +11794,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. @@ -10858,21 +11803,16 @@ class BackupManagementUsageList(msrest.serialization.Model): """ _attribute_map = { - 'value': {'key': 'value', 'type': '[BackupManagementUsage]'}, + "value": {"key": "value", "type": "[BackupManagementUsage]"}, } - def __init__( - self, - *, - value: Optional[List["_models.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 @@ -10890,7 +11830,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 @@ -10899,19 +11839,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__( @@ -10926,46 +11866,46 @@ 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 :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. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :ivar storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "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. Known values are: "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. Known values are: "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. Known values are: "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__( @@ -10981,26 +11921,28 @@ def __init__( ): """ :keyword storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :keyword storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "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. Known values are: "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. Known values are: "Invalid", "Enabled", "Disabled". + :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. Known values are: "Invalid", "Enabled", "Disabled". + :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 @@ -11023,7 +11965,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 @@ -11032,19 +11974,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__( @@ -11059,7 +12001,7 @@ 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 @@ -11067,15 +12009,15 @@ 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. Known values are: "Invalid", - "MicrosoftManaged", "CustomerManaged". + "MicrosoftManaged", and "CustomerManaged". :vartype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :ivar key_uri: Key Vault Key URI. @@ -11083,20 +12025,20 @@ class BackupResourceEncryptionConfig(msrest.serialization.Model): :ivar subscription_id: Key Vault Subscription Id. :vartype subscription_id: str :ivar last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", - "PartiallyFailed", "Failed", "Succeeded", "Initialized", "FirstInitialization". + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :vartype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :ivar infrastructure_encryption_state: Known values are: "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__( @@ -11111,7 +12053,7 @@ def __init__( ): """ :keyword encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", - "MicrosoftManaged", "CustomerManaged". + "MicrosoftManaged", and "CustomerManaged". :paramtype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :keyword key_uri: Key Vault Key URI. @@ -11119,14 +12061,15 @@ def __init__( :keyword subscription_id: Key Vault Subscription Id. :paramtype subscription_id: str :keyword last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", - "PartiallyFailed", "Failed", "Succeeded", "Initialized", "FirstInitialization". + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :paramtype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :keyword infrastructure_encryption_state: Known values are: "Invalid", "Disabled", "Enabled". + :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 @@ -11138,7 +12081,7 @@ class BackupResourceEncryptionConfigExtended(BackupResourceEncryptionConfig): """BackupResourceEncryptionConfigExtended. :ivar encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", - "MicrosoftManaged", "CustomerManaged". + "MicrosoftManaged", and "CustomerManaged". :vartype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :ivar key_uri: Key Vault Key URI. @@ -11146,10 +12089,10 @@ class BackupResourceEncryptionConfigExtended(BackupResourceEncryptionConfig): :ivar subscription_id: Key Vault Subscription Id. :vartype subscription_id: str :ivar last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", - "PartiallyFailed", "Failed", "Succeeded", "Initialized", "FirstInitialization". + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :vartype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :ivar infrastructure_encryption_state: Known values are: "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. @@ -11160,13 +12103,13 @@ 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__( @@ -11183,7 +12126,7 @@ def __init__( ): """ :keyword encryption_at_rest_type: Encryption At Rest Type. Known values are: "Invalid", - "MicrosoftManaged", "CustomerManaged". + "MicrosoftManaged", and "CustomerManaged". :paramtype encryption_at_rest_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EncryptionAtRestType :keyword key_uri: Key Vault Key URI. @@ -11191,10 +12134,11 @@ def __init__( :keyword subscription_id: Key Vault Subscription Id. :paramtype subscription_id: str :keyword last_update_status: Known values are: "Invalid", "NotEnabled", "PartiallySucceeded", - "PartiallyFailed", "Failed", "Succeeded", "Initialized", "FirstInitialization". + "PartiallyFailed", "Failed", "Succeeded", "Initialized", and "FirstInitialization". :paramtype last_update_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.LastUpdateStatus - :keyword infrastructure_encryption_state: Known values are: "Invalid", "Disabled", "Enabled". + :keyword infrastructure_encryption_state: Known values are: "Invalid", "Disabled", and + "Enabled". :paramtype infrastructure_encryption_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InfrastructureEncryptionState :keyword user_assigned_identity: User Assigned Identity Id. @@ -11203,7 +12147,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 @@ -11222,7 +12173,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 @@ -11232,19 +12183,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__( @@ -11259,7 +12210,7 @@ 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 @@ -11267,7 +12218,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 @@ -11285,7 +12236,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 @@ -11295,19 +12246,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__( @@ -11322,7 +12273,7 @@ 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 @@ -11330,30 +12281,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. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :ivar storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "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. Known values are: "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. Known values are: "Invalid", "Enabled", + :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. Known values are: "Invalid", - "Enabled", "Disabled". + "Enabled", and "Disabled". :vartype soft_delete_feature_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SoftDeleteFeatureState :ivar resource_guard_operation_requests: ResourceGuard Operation Requests. @@ -11363,13 +12314,13 @@ 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__( @@ -11386,24 +12337,24 @@ def __init__( ): """ :keyword storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.StorageType :keyword storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "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. Known values are: "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. Known values are: "Invalid", "Enabled", - "Disabled". + and "Disabled". :paramtype enhanced_security_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.EnhancedSecurityState :keyword soft_delete_feature_state: Soft Delete feature state. Known values are: "Invalid", - "Enabled", "Disabled". + "Enabled", and "Disabled". :paramtype soft_delete_feature_state: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.SoftDeleteFeatureState :keyword resource_guard_operation_requests: ResourceGuard Operation Requests. @@ -11411,7 +12362,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 @@ -11435,7 +12386,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 @@ -11445,19 +12396,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__( @@ -11472,7 +12423,7 @@ 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 @@ -11480,17 +12431,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... Known values are: "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase", "SAPHanaDBInstance". + "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. @@ -11500,9 +12451,9 @@ 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__( @@ -11517,7 +12468,7 @@ def __init__( :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", "SAPHanaDBInstance". + "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. @@ -11525,22 +12476,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. Known values - are: "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + 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. Known values are: "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. @@ -11560,15 +12511,15 @@ 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__( @@ -11587,12 +12538,12 @@ def __init__( ): """ :keyword protection_status: Specifies whether the container is registered or not. Known values - are: "Invalid", "NotProtected", "Protecting", "Protected", "ProtectionFailed". + 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. Known values are: "Invalid", + :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. @@ -11610,7 +12561,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 @@ -11622,7 +12573,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. @@ -11634,9 +12585,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__( @@ -11655,13 +12606,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. @@ -11669,29 +12620,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. 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 friendly_name: Friendly name of the backup engine. @@ -11701,9 +12647,9 @@ 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__( @@ -11717,7 +12663,7 @@ def __init__( """ :keyword backup_management_type: Backup management type for the backup engine. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword friendly_name: Friendly name of the backup engine. @@ -11725,53 +12671,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. Known values are: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + "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, "_models.Type"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): """ :keyword type: Backup management type for this container. Known values are: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + "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. Known values + :ivar backup_management_type: Backup management type for this container. Required. 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 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", "HanaHSRContainer". + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", and "HanaHSRContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType :ivar backup_engine_name: Backup engine name. @@ -11785,16 +12726,16 @@ 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__( @@ -11809,15 +12750,15 @@ def __init__( **kwargs ): """ - :keyword backup_management_type: Required. Backup management type for this container. Known + :keyword backup_management_type: Backup management type for this container. Required. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :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", "HanaHSRContainer". + "SQLAGWorkLoadContainer", "StorageContainer", "GenericContainer", and "HanaHSRContainer". :paramtype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ContainerType :keyword backup_engine_name: Backup engine name. @@ -11829,7 +12770,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 @@ -11838,25 +12779,25 @@ 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. 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 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", "SAPHanaDBInstance". + "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__( @@ -11869,32 +12810,32 @@ def __init__( """ :keyword backup_management_type: Backup management type for this container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :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", "SAPHanaDBInstance". + "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. 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. 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 @@ -11907,11 +12848,11 @@ 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__( @@ -11927,12 +12868,12 @@ def __init__( """ :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. 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 @@ -11944,7 +12885,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 @@ -11952,38 +12893,35 @@ 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. 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 """ _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, "_models.BackupManagementType"]] = None, - **kwargs + self, *, backup_management_type: Optional[Union[str, "_models.BackupManagementType"]] = None, **kwargs ): """ :keyword backup_management_type: Backup management type for this container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. @@ -11991,7 +12929,7 @@ class BMSRPQueryObject(msrest.serialization.Model): :ivar end_date: Backup copies created before this time. :vartype end_date: ~datetime.datetime :ivar restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", "Log", - "Differential", "FullAndDifferential", "All", "Incremental", "SnapshotFull", + "Differential", "FullAndDifferential", "All", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :vartype restore_point_query_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointQueryType @@ -12003,11 +12941,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__( @@ -12026,7 +12964,7 @@ def __init__( :keyword end_date: Backup copies created before this time. :paramtype end_date: ~datetime.datetime :keyword restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", - "Log", "Differential", "FullAndDifferential", "All", "Incremental", "SnapshotFull", + "Log", "Differential", "FullAndDifferential", "All", "Incremental", "SnapshotFull", and "SnapshotCopyOnlyFull". :paramtype restore_point_query_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestorePointQueryType @@ -12036,7 +12974,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 @@ -12044,36 +12982,36 @@ 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. 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. Known values are: "Invalid", "SQLInstance", - "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase", + "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemType :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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__( @@ -12088,33 +13026,33 @@ def __init__( """ :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. Known values are: "Invalid", "SQLInstance", - "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase", + "SQLDataBase", "SAPHanaSystem", "SAPHanaDatabase", "SAPAseSystem", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemType :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. Known values are: "Invalid", - "NotProtected", "Protecting", "Protected", "ProtectionFailed". + "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. @@ -12128,10 +13066,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__( @@ -12153,14 +13091,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. @@ -12172,9 +13110,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__( @@ -12193,13 +13131,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. @@ -12208,25 +13146,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["_models.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. @@ -12235,25 +13170,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["_models.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. @@ -12264,8 +13196,8 @@ 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__( @@ -12282,12 +13214,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. @@ -12303,10 +13235,10 @@ 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__( @@ -12331,14 +13263,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. @@ -12359,11 +13291,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__( @@ -12393,7 +13325,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 @@ -12401,7 +13333,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. @@ -12423,28 +13355,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 @@ -12452,7 +13380,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. @@ -12466,10 +13394,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__( @@ -12491,14 +13419,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. @@ -12506,24 +13434,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["_models.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. @@ -12534,8 +13457,8 @@ 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__( @@ -12552,12 +13475,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. @@ -12565,24 +13488,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. @@ -12592,29 +13510,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. @@ -12625,16 +13537,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. @@ -12643,12 +13551,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: @@ -12658,29 +13566,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. @@ -12693,9 +13595,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__( @@ -12715,13 +13617,13 @@ 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. @@ -12730,7 +13632,7 @@ class DpmBackupEngine(BackupEngineBase): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the backup engine. 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 registration_status: Registration status of the backup engine with the Recovery Services @@ -12741,8 +13643,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. Known - values are: "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 @@ -12764,23 +13666,23 @@ 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__( @@ -12805,7 +13707,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the backup engine. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -12833,11 +13735,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. @@ -12845,24 +13761,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. @@ -12872,29 +13783,23 @@ 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. @@ -12903,7 +13808,7 @@ class DpmJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -12916,8 +13821,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 @@ -12941,26 +13846,26 @@ 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__( @@ -12989,7 +13894,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -13022,8 +13927,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 @@ -13034,7 +13948,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. @@ -13047,9 +13961,9 @@ 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__( @@ -13069,13 +13983,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. @@ -13091,11 +14005,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__( @@ -13120,7 +14034,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 @@ -13128,24 +14042,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -13160,7 +14074,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. Known values are: "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 @@ -13182,12 +14096,14 @@ class DPMProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of the managed item. :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -13196,33 +14112,34 @@ class DPMProtectedItem(ProtectedItem): """ _validation = { - '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'}, + "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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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__( @@ -13242,6 +14159,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, friendly_name: Optional[str] = None, backup_engine_name: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectedItemState"]] = None, @@ -13261,7 +14179,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. Known values are: "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 @@ -13284,27 +14202,46 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword friendly_name: Friendly name of the managed item. :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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__(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, + soft_delete_retention_period=soft_delete_retention_period, + **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. @@ -13338,20 +14275,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__( @@ -13403,7 +14340,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 @@ -13420,7 +14357,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 @@ -13437,11 +14374,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__( @@ -13467,7 +14404,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 @@ -13475,7 +14412,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. @@ -13483,31 +14420,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. @@ -13521,61 +14454,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] @@ -13584,8 +14512,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 @@ -13598,15 +14526,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__( @@ -13629,15 +14557,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. @@ -13648,8 +14576,8 @@ 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__( @@ -13666,7 +14594,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 @@ -13680,7 +14608,7 @@ class GenericContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -13688,17 +14616,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -13712,18 +14640,18 @@ 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__( @@ -13743,7 +14671,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -13760,13 +14688,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. @@ -13779,9 +14714,9 @@ 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__( @@ -13801,30 +14736,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -13839,7 +14774,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. Known values are: "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 @@ -13861,17 +14796,19 @@ class GenericProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of the container. :vartype friendly_name: str :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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] @@ -13880,38 +14817,39 @@ class GenericProtectedItem(ProtectedItem): """ _validation = { - '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': 'long'}, - 'source_associations': {'key': 'sourceAssociations', 'type': '{str}'}, - 'fabric_name': {'key': 'fabricName', 'type': 'str'}, - } - - 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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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__( # pylint: disable=too-many-locals self, *, container_name: Optional[str] = None, @@ -13928,6 +14866,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, friendly_name: Optional[str] = None, policy_state: Optional[str] = None, protection_state: Optional[Union[str, "_models.ProtectionState"]] = None, @@ -13949,7 +14888,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. Known values are: "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 @@ -13972,25 +14911,44 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword friendly_name: Friendly name of the container. :paramtype friendly_name: str :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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__(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, + soft_delete_retention_period=soft_delete_retention_period, + **kwargs + ) + self.protected_item_type = "GenericProtectedItem" # type: str self.friendly_name = friendly_name self.policy_state = policy_state self.protection_state = protection_state @@ -14006,8 +14964,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] @@ -14023,16 +14981,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__( @@ -14060,8 +15018,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 @@ -14072,8 +15034,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 @@ -14086,15 +15048,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__( @@ -14117,15 +15079,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. @@ -14133,24 +15095,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 @@ -14163,9 +15120,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__( @@ -14185,7 +15142,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 @@ -14196,8 +15153,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). @@ -14205,27 +15162,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 @@ -14234,8 +15186,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. @@ -14251,15 +15203,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__( @@ -14284,21 +15236,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 @@ -14341,26 +15293,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__( @@ -14424,8 +15382,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 @@ -14443,21 +15401,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. @@ -14520,37 +15478,35 @@ 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, *, @@ -14580,7 +15536,7 @@ def __init__( :keyword recovery_point_id: ID of the backup copy to be recovered. :paramtype recovery_point_id: str :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. @@ -14642,8 +15598,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 @@ -14666,18 +15622,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. @@ -14743,32 +15699,35 @@ 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__( @@ -14801,7 +15760,7 @@ def __init__( :keyword recovery_point_id: ID of the backup copy to be recovered. :paramtype recovery_point_id: str :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. @@ -14866,12 +15825,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. @@ -14881,29 +15862,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 @@ -14915,8 +15890,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__( @@ -14934,7 +15909,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 @@ -14953,7 +15928,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 @@ -14962,19 +15937,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__( @@ -14989,18 +15964,18 @@ 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 :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 @@ -15015,9 +15990,9 @@ 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__( @@ -15039,13 +16014,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. @@ -15059,35 +16034,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["_models.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. @@ -15096,25 +16065,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["_models.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: @@ -15124,8 +16088,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__( @@ -15141,25 +16105,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. Known values are: "Invalid", "InProgress", "Completed", - "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + "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. 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. Known values are: "Invalid", "Register", "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :vartype operation: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobOperationType :ivar job_id: JobID represents the job uniquely. @@ -15171,12 +16135,12 @@ 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__( @@ -15192,16 +16156,16 @@ def __init__( ): """ :keyword status: Status of the job. Known values are: "Invalid", "InProgress", "Completed", - "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + "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. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: Type of operation. Known values are: "Invalid", "Register", "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :paramtype operation: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.JobOperationType :keyword job_id: JobID represents the job uniquely. @@ -15211,7 +16175,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 @@ -15234,7 +16198,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 @@ -15243,19 +16207,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__( @@ -15270,14 +16234,14 @@ 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 :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 @@ -15292,16 +16256,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["_models.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 @@ -15310,11 +16270,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. @@ -15326,9 +16286,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__( @@ -15347,35 +16307,35 @@ 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__( @@ -15394,17 +16354,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. Known values are: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :vartype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceHealthStatus @@ -15414,8 +16374,8 @@ 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__( @@ -15427,7 +16387,7 @@ def __init__( ): """ :keyword resource_health_status: Resource Health Status. Known values are: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :paramtype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceHealthStatus @@ -15435,12 +16395,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. @@ -15450,60 +16410,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] @@ -15512,8 +16467,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. @@ -15521,62 +16476,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] @@ -15585,8 +16534,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: @@ -15603,15 +16552,15 @@ 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__( @@ -15637,8 +16586,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 @@ -15650,30 +16599,26 @@ 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. @@ -15682,7 +16627,7 @@ class MabContainer(ProtectionContainer): :vartype friendly_name: str :ivar backup_management_type: Type of backup management for the container. 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 registration_status: Status of registration of the container with the Recovery Services @@ -15690,17 +16635,17 @@ 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. Known values are: "Invalid", "Unknown", - "IaasVMContainer", "IaasVMServiceContainer", "DPMContainer", "AzureBackupServerContainer", - "MABContainer", "Cluster", "AzureSqlContainer", "Windows", "VCenter", "VMAppContainer", + 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", + "Microsoft.ClassicCompute/virtualMachines", "Microsoft.Compute/virtualMachines", and "AzureWorkloadContainer". :vartype container_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerType @@ -15709,9 +16654,9 @@ class MabContainer(ProtectionContainer): :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. @@ -15725,23 +16670,23 @@ 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__( @@ -15766,7 +16711,7 @@ def __init__( :paramtype friendly_name: str :keyword backup_management_type: Type of backup management for the container. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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 @@ -15780,9 +16725,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. @@ -15794,8 +16739,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 @@ -15805,7 +16757,7 @@ 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. @@ -15813,7 +16765,7 @@ class MabContainerExtendedInfo(msrest.serialization.Model): :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", "SAPHanaDBInstance". + "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. @@ -15825,11 +16777,11 @@ 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__( @@ -15848,7 +16800,7 @@ def __init__( :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", "SAPHanaDBInstance". + "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. @@ -15858,7 +16810,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 @@ -15866,7 +16818,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. @@ -15880,10 +16832,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__( @@ -15905,14 +16857,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. @@ -15924,44 +16876,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. 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 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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :ivar container_name: Unique name of container. @@ -15976,7 +16924,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. Known values are: "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 @@ -15998,6 +16946,8 @@ class MabFileFolderProtectedItem(ProtectedItem): :vartype is_archive_enabled: bool :ivar policy_name: Name of the policy used for protection. :vartype policy_name: str + :ivar soft_delete_retention_period: Soft delete retention period in days. + :vartype soft_delete_retention_period: int :ivar friendly_name: Friendly name of this backup item. :vartype friendly_name: str :ivar computer_name: Name of the computer associated with this backup item. @@ -16009,46 +16959,47 @@ 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}, - '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': '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"}, + "soft_delete_retention_period": {"key": "softDeleteRetentionPeriod", "type": "int"}, + "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, *, container_name: Optional[str] = None, @@ -16065,6 +17016,7 @@ def __init__( resource_guard_operation_requests: Optional[List[str]] = None, is_archive_enabled: Optional[bool] = None, policy_name: Optional[str] = None, + soft_delete_retention_period: Optional[int] = None, friendly_name: Optional[str] = None, computer_name: Optional[str] = None, last_backup_status: Optional[str] = None, @@ -16087,7 +17039,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. Known values are: "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 @@ -16110,6 +17062,8 @@ def __init__( :paramtype is_archive_enabled: bool :keyword policy_name: Name of the policy used for protection. :paramtype policy_name: str + :keyword soft_delete_retention_period: Soft delete retention period in days. + :paramtype soft_delete_retention_period: int :keyword friendly_name: Friendly name of this backup item. :paramtype friendly_name: str :keyword computer_name: Name of the computer associated with this backup item. @@ -16121,13 +17075,30 @@ 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__(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, + soft_delete_retention_period=soft_delete_retention_period, + **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 @@ -16137,7 +17108,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. @@ -16149,9 +17120,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__( @@ -16170,13 +17141,13 @@ 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. @@ -16185,7 +17156,7 @@ class MabJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -16198,8 +17169,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 @@ -16211,13 +17182,13 @@ class MabJob(Job): :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", "GenericContainer". + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :vartype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabServerType :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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :ivar error_details: The errors. @@ -16229,25 +17200,25 @@ 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__( @@ -16275,7 +17246,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -16298,13 +17269,13 @@ def __init__( :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", "GenericContainer". + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :paramtype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.MabServerType :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", "SAPHanaDBInstance". + "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadType :keyword error_details: The errors. @@ -16314,8 +17285,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 @@ -16325,7 +17305,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. @@ -16338,9 +17318,9 @@ 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__( @@ -16360,13 +17340,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. @@ -16382,11 +17362,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__( @@ -16411,7 +17391,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 @@ -16426,8 +17406,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] @@ -16439,15 +17419,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__( @@ -16471,17 +17451,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. Known values are: "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. @@ -16498,11 +17482,11 @@ 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__( @@ -16517,7 +17501,7 @@ def __init__( ): """ :keyword retention_schedule_format_type: Retention schedule format type for monthly retention - policy. Known values are: "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. @@ -16532,7 +17516,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 @@ -16540,25 +17524,25 @@ 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. Known values are: - "Invalid", "InstantRP", "HardenedRP", "ArchivedRP". + "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. Known values are: "Invalid", - "InstantRP", "HardenedRP", "ArchivedRP". + "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__( @@ -16573,21 +17557,21 @@ def __init__( :keyword object_type: Gets the class type. :paramtype object_type: str :keyword source_tier_type: Source tier from where RP needs to be moved. Known values are: - "Invalid", "InstantRP", "HardenedRP", "ArchivedRP". + "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. Known values are: "Invalid", - "InstantRP", "HardenedRP", "ArchivedRP". + "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. @@ -16597,29 +17581,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. @@ -16627,24 +17605,19 @@ class NewErrorResponse(msrest.serialization.Model): """ _attribute_map = { - 'error': {'key': 'error', 'type': 'NewErrorResponseError'}, + "error": {"key": "error", "type": "NewErrorResponseError"}, } - def __init__( - self, - *, - error: Optional["_models.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. @@ -16663,28 +17636,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 @@ -16697,38 +17666,33 @@ 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. Known values are: "Continue", @@ -16740,7 +17704,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 @@ -16749,8 +17713,8 @@ 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__( @@ -16770,14 +17734,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 @@ -16794,7 +17758,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 @@ -16806,9 +17770,9 @@ 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__( @@ -16829,7 +17793,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 @@ -16839,11 +17803,11 @@ 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. @@ -16851,7 +17815,7 @@ class OperationStatus(msrest.serialization.Model): :ivar name: Name of the operation. :vartype name: str :ivar status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", - "Failed", "Canceled". + "Failed", and "Canceled". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatusValues :ivar start_time: Operation start time. Format: ISO-8601. @@ -16866,19 +17830,19 @@ 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, "_models.OperationStatusValues"]] = None, start_time: Optional[datetime.datetime] = None, @@ -16893,7 +17857,7 @@ def __init__( :keyword name: Name of the operation. :paramtype name: str :keyword status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", - "Failed", "Canceled". + "Failed", and "Canceled". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.OperationStatusValues :keyword start_time: Operation start time. Format: ISO-8601. @@ -16906,7 +17870,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 @@ -16916,7 +17880,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. @@ -16926,60 +17890,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] @@ -16988,34 +17948,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 @@ -17024,8 +17979,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] @@ -17034,21 +17989,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. @@ -17057,8 +18008,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 @@ -17068,8 +18019,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: @@ -17077,27 +18028,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["_models.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 @@ -17106,8 +18052,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: @@ -17115,31 +18061,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["_models.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. @@ -17149,16 +18090,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. @@ -17166,16 +18103,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. Known values are: - "Invalid", "Success", "Failed". + "Invalid", "Success", and "Failed". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.InquiryStatus :ivar code: Error code of protectable item. :vartype code: str @@ -17184,9 +18121,9 @@ 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__( @@ -17199,29 +18136,29 @@ def __init__( ): """ :keyword status: Status of protectable item, i.e. InProgress,Succeeded,Failed. Known values - are: "Invalid", "Success", "Failed". + 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. Known values are: "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 @@ -17233,17 +18170,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__( @@ -17257,11 +18194,11 @@ def __init__( **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. Known values are: "Invalid", "Vault", + :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 @@ -17271,7 +18208,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 @@ -17279,38 +18216,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] @@ -17319,8 +18250,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 @@ -17329,13 +18260,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__( @@ -17351,40 +18282,40 @@ 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. Known values are: - "Invalid", "VM", "FileFolder", "AzureSqlDb", "SQLDB", "Exchange", "Sharepoint", "VMwareVM", - "SystemState", "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", - "SAPHanaDatabase", "SAPAseDatabase", "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 + :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__( @@ -17400,7 +18331,7 @@ def __init__( :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", "SAPHanaDBInstance". + "SAPHanaDatabase", "SAPAseDatabase", and "SAPHanaDBInstance". :paramtype resource_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.DataSourceType :keyword resource_id: ARM Virtual Machine Id. @@ -17410,17 +18341,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. Known values are: "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 @@ -17438,12 +18369,12 @@ 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__( @@ -17458,7 +18389,7 @@ def __init__( **kwargs ): """ - :keyword status: Validation Status. Known values are: "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. @@ -17475,7 +18406,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 @@ -17484,7 +18415,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. @@ -17492,28 +18423,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. - Known values are: "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 @@ -17527,9 +18453,12 @@ 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__( @@ -17542,7 +18471,7 @@ def __init__( ): """ :keyword provisioning_state: Gets or sets provisioning state of the private endpoint - connection. Known values are: "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 @@ -17554,7 +18483,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 @@ -17574,7 +18503,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 @@ -17584,19 +18513,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__( @@ -17611,7 +18540,7 @@ 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 @@ -17619,14 +18548,14 @@ 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. Known values are: "Pending", "Approved", "Rejected", + :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 @@ -17637,9 +18566,9 @@ 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__( @@ -17652,7 +18581,7 @@ def __init__( ): """ :keyword status: Gets or sets the status. Known values are: "Pending", "Approved", "Rejected", - "Disconnected". + and "Disconnected". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionStatus :keyword description: Gets or sets description. @@ -17660,7 +18589,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 @@ -17680,7 +18609,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 @@ -17689,19 +18618,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__( @@ -17716,7 +18645,7 @@ 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 @@ -17724,7 +18653,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 @@ -17740,8 +18669,8 @@ 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__( @@ -17759,25 +18688,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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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. 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 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", "SAPHanaDBInstance". + "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 @@ -17794,15 +18723,15 @@ 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__( @@ -17821,18 +18750,18 @@ def __init__( ): """ :keyword health_state: Health State for the backed up item. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :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", "SAPHanaDBInstance". + "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. @@ -17848,7 +18777,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 @@ -17874,7 +18803,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 @@ -17883,19 +18812,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__( @@ -17910,14 +18839,14 @@ 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 :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 @@ -17933,8 +18862,8 @@ 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__( @@ -17952,7 +18881,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 @@ -17970,7 +18899,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 @@ -17979,19 +18908,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__( @@ -18006,7 +18935,7 @@ 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 @@ -18014,7 +18943,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 @@ -18030,8 +18959,8 @@ 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__( @@ -18049,20 +18978,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. 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 item_type: Type of workload this item represents. Known values are: "Invalid", - "SQLInstance", "SQLAvailabilityGroupContainer". + "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 @@ -18071,10 +19000,10 @@ 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__( @@ -18089,11 +19018,11 @@ def __init__( """ :keyword backup_management_type: Backup management type for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword item_type: Type of workload this item represents. Known values are: "Invalid", - "SQLInstance", "SQLAvailabilityGroupContainer". + "SQLInstance", and "SQLAvailabilityGroupContainer". :paramtype item_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.IntentItemType :keyword parent_name: Parent name of the intent. @@ -18101,7 +19030,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 @@ -18122,7 +19051,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 @@ -18131,19 +19060,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__( @@ -18158,14 +19087,14 @@ 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 :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 @@ -18181,8 +19110,8 @@ 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__( @@ -18200,16 +19129,16 @@ 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. 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 fabric_name: Fabric name for filter. @@ -18217,15 +19146,15 @@ class ProtectionPolicyQueryObject(msrest.serialization.Model): :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", "SAPHanaDBInstance". + "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__( @@ -18239,7 +19168,7 @@ def __init__( """ :keyword backup_management_type: Backup management type for the backup policy. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword fabric_name: Fabric name for filter. @@ -18247,11 +19176,11 @@ def __init__( :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", "SAPHanaDBInstance". + "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 @@ -18271,7 +19200,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 @@ -18280,19 +19209,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__( @@ -18307,14 +19236,14 @@ 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 :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 @@ -18330,8 +19259,8 @@ 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__( @@ -18349,11 +19278,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. @@ -18369,10 +19298,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__( @@ -18396,14 +19325,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: @@ -18413,42 +19342,36 @@ 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. Known values are: "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__( @@ -18462,11 +19385,11 @@ def __init__( :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. Known values are: "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 @@ -18485,7 +19408,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 @@ -18494,19 +19417,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__( @@ -18521,14 +19444,14 @@ 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 :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 @@ -18544,8 +19467,8 @@ 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__( @@ -18563,19 +19486,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. Known values are: "Invalid", "InstantRP", "HardenedRP", - "ArchivedRP". + and "ArchivedRP". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType :ivar status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", - "Deleted", "Rehydrated". + "Deleted", and "Rehydrated". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierStatus :ivar extended_info: Recovery point tier status. @@ -18583,9 +19506,9 @@ 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__( @@ -18598,17 +19521,17 @@ def __init__( ): """ :keyword type: Recovery point tier type. Known values are: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + "HardenedRP", and "ArchivedRP". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType :keyword status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", - "Deleted", "Rehydrated". + "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 @@ -18618,11 +19541,11 @@ class RecoveryPointTierInformationV2(RecoveryPointTierInformation): """RecoveryPoint Tier Information V2. :ivar type: Recovery point tier type. Known values are: "Invalid", "InstantRP", "HardenedRP", - "ArchivedRP". + and "ArchivedRP". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType :ivar status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", - "Deleted", "Rehydrated". + "Deleted", and "Rehydrated". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierStatus :ivar extended_info: Recovery point tier status. @@ -18630,9 +19553,9 @@ 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__( @@ -18645,20 +19568,20 @@ def __init__( ): """ :keyword type: Recovery point tier type. Known values are: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + "HardenedRP", and "ArchivedRP". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointTierType :keyword status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", - "Deleted", "Rehydrated". + "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: @@ -18668,8 +19591,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__( @@ -18685,12 +19608,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: @@ -18705,10 +19628,13 @@ 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__( @@ -18731,7 +19657,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 @@ -18752,7 +19678,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 @@ -18762,19 +19688,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__( @@ -18789,7 +19715,7 @@ 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 @@ -18797,7 +19723,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 @@ -18813,8 +19739,8 @@ 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__( @@ -18832,11 +19758,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. @@ -18848,9 +19774,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__( @@ -18869,7 +19795,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 @@ -18889,7 +19815,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 @@ -18898,19 +19824,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__( @@ -18925,18 +19851,18 @@ 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 :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 @@ -18944,14 +19870,14 @@ class RetentionDuration(msrest.serialization.Model): 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. Known values are: "Invalid", - "Days", "Weeks", "Months", "Years". + "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__( @@ -18967,16 +19893,16 @@ def __init__( 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. Known values are: - "Invalid", "Days", "Weeks", "Months", "Years". + "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. @@ -18984,24 +19910,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 @@ -19015,9 +19936,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__( @@ -19039,7 +19960,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 @@ -19050,8 +19971,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: @@ -19059,27 +19980,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["_models.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 @@ -19088,11 +20004,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. Known values - are: "Invalid", "Daily", "Weekly", "Hourly". + 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. @@ -19107,16 +20023,16 @@ 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__( @@ -19131,7 +20047,7 @@ def __init__( ): """ :keyword schedule_run_frequency: Frequency of the schedule operation of this policy. Known - values are: "Invalid", "Daily", "Weekly", "Hourly". + 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. @@ -19145,8 +20061,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 @@ -19159,11 +20075,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. Known values - are: "Invalid", "Daily", "Weekly", "Hourly". + 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. @@ -19175,15 +20091,15 @@ 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__( @@ -19197,7 +20113,7 @@ def __init__( ): """ :keyword schedule_run_frequency: Frequency of the schedule operation of this policy. Known - values are: "Invalid", "Daily", "Weekly", "Hourly". + 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. @@ -19209,18 +20125,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. Known values are: "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. @@ -19230,9 +20146,9 @@ 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__( @@ -19244,7 +20160,7 @@ def __init__( **kwargs ): """ - :keyword type: Type of data directory mapping. Known values are: "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. @@ -19252,16 +20168,17 @@ 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. Known values are: "Invalid", "Data", "Log". + :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 :ivar source_logical_name: Restore source logical name path. @@ -19273,10 +20190,10 @@ 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__( @@ -19289,7 +20206,7 @@ def __init__( **kwargs ): """ - :keyword mapping_type: Type of data directory mapping. Known values are: "Invalid", "Data", + :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 @@ -19300,18 +20217,19 @@ 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. Known values are: "Invalid", "Full", - "Differential", "Log", "CopyOnlyFull", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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 @@ -19326,10 +20244,10 @@ class SubProtectionPolicy(msrest.serialization.Model): """ _attribute_map = { - 'policy_type': {'key': 'policyType', 'type': 'str'}, - 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, - 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, - 'tiering_policy': {'key': 'tieringPolicy', 'type': '{TieringPolicy}'}, + "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__( @@ -19343,7 +20261,8 @@ def __init__( ): """ :keyword policy_type: Type of backup policy type. Known values are: "Invalid", "Full", - "Differential", "Log", "CopyOnlyFull", "Incremental", "SnapshotFull", "SnapshotCopyOnlyFull". + "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: @@ -19357,14 +20276,14 @@ def __init__( :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. @@ -19374,33 +20293,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. Known values are: - "Invalid", "FailOnConflict", "Overwrite". + "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. @@ -19413,10 +20326,10 @@ 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__( @@ -19430,7 +20343,7 @@ def __init__( ): """ :keyword overwrite_option: Can Overwrite if Target DataBase already exists. Known values are: - "Invalid", "FailOnConflict", "Overwrite". + "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. @@ -19441,42 +20354,42 @@ 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 TieringPolicy(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", "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", "Years". - :vartype duration_type: str or - ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType + 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'}, + "tiering_mode": {"key": "tieringMode", "type": "str"}, + "duration": {"key": "duration", "type": "int"}, + "duration_type": {"key": "durationType", "type": "str"}, } def __init__( @@ -19490,13 +20403,13 @@ def __init__( """ :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", "DoNotTier". + "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 @@ -19505,31 +20418,31 @@ def __init__( :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", "Years". + "Months", and "Years". :paramtype duration_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType """ - super(TieringPolicy, self).__init__(**kwargs) + super().__init__(**kwargs) self.tiering_mode = tiering_mode self.duration = duration self.duration_type = duration_type -class TokenInformation(msrest.serialization.Model): +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__( @@ -19544,30 +20457,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. Known values are: "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] @@ -19576,19 +20489,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__( @@ -19603,22 +20516,22 @@ def __init__( **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. Known values are: "Invalid", "Vault", + :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 @@ -19627,7 +20540,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: @@ -19637,8 +20550,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__( @@ -19654,12 +20567,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 @@ -19668,100 +20581,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["_models.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 @@ -19770,38 +20665,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["_models.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. @@ -19810,25 +20700,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["_models.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. @@ -19837,25 +20722,20 @@ 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["_models.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. @@ -19864,7 +20744,7 @@ class VaultJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -19877,8 +20757,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 @@ -19894,22 +20774,22 @@ 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__( @@ -19934,7 +20814,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementType :keyword operation: The operation name. @@ -19959,15 +20839,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. @@ -19979,9 +20868,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__( @@ -20000,13 +20889,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. @@ -20014,24 +20903,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. @@ -20043,8 +20927,8 @@ 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__( @@ -20062,12 +20946,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. @@ -20081,9 +20965,9 @@ 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__( @@ -20104,13 +20988,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: @@ -20121,8 +21005,8 @@ 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__( @@ -20139,27 +21023,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__( @@ -20174,13 +21058,13 @@ def __init__( :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 @@ -20200,7 +21084,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 @@ -20209,19 +21093,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__( @@ -20236,14 +21120,14 @@ 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 :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 @@ -20259,16 +21143,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["_models.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 @@ -20278,7 +21158,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 @@ -20296,7 +21176,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 @@ -20306,19 +21186,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__( @@ -20333,7 +21213,7 @@ 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 @@ -20341,7 +21221,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 @@ -20357,8 +21237,8 @@ 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__( @@ -20376,15 +21256,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. - Known values are: "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. @@ -20404,12 +21284,12 @@ 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__( @@ -20425,7 +21305,7 @@ def __init__( ): """ :keyword retention_schedule_format_type: Retention schedule format for yearly retention policy. - Known values are: "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. @@ -20443,7 +21323,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/_recovery_services_backup_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py index 9b85c432ca36..ab87b657e3cf 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 @@ -11,31 +11,30 @@ class AcquireStorageAccountLock(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether storage account lock is to be acquired for this container or not. - """ + """Whether storage account lock is to be acquired for this container or not.""" ACQUIRE = "Acquire" NOT_ACQUIRE = "NotAcquire" + class AzureFileShareType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """File Share type XSync or XSMB. - """ + """File Share type XSync or XSMB.""" INVALID = "Invalid" XSMB = "XSMB" X_SYNC = "XSync" + class BackupEngineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the backup engine. - """ + """Type of the backup engine.""" INVALID = "Invalid" DPM_BACKUP_ENGINE = "DpmBackupEngine" AZURE_BACKUP_SERVER_ENGINE = "AzureBackupServerEngine" + class BackupItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of backup items associated with this container. - """ + """Type of backup items associated with this container.""" INVALID = "Invalid" VM = "VM" @@ -54,9 +53,9 @@ class BackupItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SAP_ASE_DATABASE = "SAPAseDatabase" SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" + class BackupManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup management type to execute the current job. - """ + """Backup management type to execute the current job.""" INVALID = "Invalid" AZURE_IAAS_VM = "AzureIaasVM" @@ -68,9 +67,9 @@ class BackupManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_WORKLOAD = "AzureWorkload" DEFAULT_BACKUP = "DefaultBackup" + class BackupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of backup, viz. Full, Differential, Log or CopyOnlyFull - """ + """Type of backup, viz. Full, Differential, Log or CopyOnlyFull.""" INVALID = "Invalid" FULL = "Full" @@ -81,9 +80,9 @@ class BackupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNAPSHOT_FULL = "SnapshotFull" SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" + class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of container for filter - """ + """Type of container for filter.""" INVALID = "Invalid" UNKNOWN = "Unknown" @@ -102,9 +101,9 @@ class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): GENERIC_CONTAINER = "GenericContainer" HANA_HSR_CONTAINER = "HanaHSRContainer" + class CopyOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Options to resolve copy conflicts. - """ + """Options to resolve copy conflicts.""" INVALID = "Invalid" CREATE_COPY = "CreateCopy" @@ -112,6 +111,7 @@ class CopyOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): OVERWRITE = "Overwrite" FAIL_ON_CONFLICT = "FailOnConflict" + 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(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEFAULT = "Default" RECOVER = "Recover" + class DataMoveLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """DataMove Level - """ + """DataMove Level.""" INVALID = "Invalid" VAULT = "Vault" CONTAINER = "Container" + class DataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of workload this item represents. - """ + """Type of workload this item represents.""" INVALID = "Invalid" VM = "VM" @@ -150,7 +150,9 @@ class DataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SAP_ASE_DATABASE = "SAPAseDatabase" SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" + class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DayOfWeek.""" SUNDAY = "Sunday" MONDAY = "Monday" @@ -160,60 +162,60 @@ class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): FRIDAY = "Friday" SATURDAY = "Saturday" + class DedupState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Vault Dedup state - """ + """Vault Dedup state.""" INVALID = "Invalid" ENABLED = "Enabled" DISABLED = "Disabled" + class EncryptionAtRestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Encryption At Rest Type - """ + """Encryption At Rest Type.""" INVALID = "Invalid" MICROSOFT_MANAGED = "MicrosoftManaged" CUSTOMER_MANAGED = "CustomerManaged" + class EnhancedSecurityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled or Disabled. - """ + """Enabled or Disabled.""" INVALID = "Invalid" ENABLED = "Enabled" DISABLED = "Disabled" + class FabricName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the fabric name - Azure or AD - """ + """Specifies the fabric name - Azure or AD.""" INVALID = "Invalid" AZURE = "Azure" + class HealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Health State for the backed up item. - """ + """Health State for the backed up item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" + class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Health status of protected item. - """ + """Health status of protected item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" + class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """HTTP Status Code of the operation. - """ + """HTTP Status Code of the operation.""" - CONTINUE_ENUM = "Continue" + CONTINUE = "Continue" SWITCHING_PROTOCOLS = "SwitchingProtocols" OK = "OK" CREATED = "Created" @@ -261,37 +263,41 @@ class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): GATEWAY_TIMEOUT = "GatewayTimeout" HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" + class IAASVMPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """IAASVMPolicyType.""" INVALID = "Invalid" V1 = "V1" V2 = "V2" + class InfrastructureEncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """InfrastructureEncryptionState.""" INVALID = "Invalid" DISABLED = "Disabled" ENABLED = "Enabled" + class InquiryStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of protectable item, i.e. InProgress,Succeeded,Failed - """ + """Status of protectable item, i.e. InProgress,Succeeded,Failed.""" INVALID = "Invalid" SUCCESS = "Success" FAILED = "Failed" + class IntentItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of workload this item represents - """ + """Type of workload this item represents.""" INVALID = "Invalid" SQL_INSTANCE = "SQLInstance" SQL_AVAILABILITY_GROUP_CONTAINER = "SQLAvailabilityGroupContainer" + class JobOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of operation. - """ + """Type of operation.""" INVALID = "Invalid" REGISTER = "Register" @@ -305,9 +311,9 @@ class JobOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNDELETE = "Undelete" UPDATE_CUSTOMER_MANAGED_KEY = "UpdateCustomerManagedKey" + class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the job. - """ + """Status of the job.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -317,22 +323,26 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELLED = "Cancelled" CANCELLING = "Cancelling" + class JobSupportedAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JobSupportedAction.""" INVALID = "Invalid" CANCELLABLE = "Cancellable" RETRIABLE = "Retriable" + class LastBackupStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Last backup operation status. Possible values: Healthy, Unhealthy. - """ + """Last backup operation status. Possible values: Healthy, Unhealthy.""" INVALID = "Invalid" HEALTHY = "Healthy" UNHEALTHY = "Unhealthy" IR_PENDING = "IRPending" + class LastUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LastUpdateStatus.""" INVALID = "Invalid" NOT_ENABLED = "NotEnabled" @@ -343,9 +353,9 @@ class LastUpdateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): INITIALIZED = "Initialized" FIRST_INITIALIZATION = "FirstInitialization" + class MabServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Server type of MAB container. - """ + """Server type of MAB container.""" INVALID = "Invalid" UNKNOWN = "Unknown" @@ -363,7 +373,9 @@ class MabServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): STORAGE_CONTAINER = "StorageContainer" GENERIC_CONTAINER = "GenericContainer" + class MonthOfYear(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonthOfYear.""" INVALID = "Invalid" JANUARY = "January" @@ -379,9 +391,9 @@ class MonthOfYear(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOVEMBER = "November" DECEMBER = "December" + class OperationStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Operation status. - """ + """Operation status.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -389,25 +401,25 @@ class OperationStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" CANCELED = "Canceled" + class OperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Re-Do Operation - """ + """Re-Do Operation.""" INVALID = "Invalid" REGISTER = "Register" REREGISTER = "Reregister" + class OverwriteOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Can Overwrite if Target DataBase already exists - """ + """Can Overwrite if Target DataBase already exists.""" INVALID = "Invalid" FAIL_ON_CONFLICT = "FailOnConflict" OVERWRITE = "Overwrite" + class PolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of backup policy type - """ + """Type of backup policy type.""" INVALID = "Invalid" FULL = "Full" @@ -418,21 +430,22 @@ class PolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNAPSHOT_FULL = "SnapshotFull" SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" + class PrivateEndpointConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets the status - """ + """Gets or sets the status.""" PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + 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 + #. Classic Compute Azure VM is Microsoft.ClassicCompute/virtualMachines. """ INVALID = "Invalid" @@ -454,9 +467,9 @@ class ProtectableContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 - """ + """Health status of the backup item, evaluated based on last heartbeat received.""" INVALID = "Invalid" HEALTHY = "Healthy" @@ -464,9 +477,9 @@ class ProtectedItemHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_REACHABLE = "NotReachable" IR_PENDING = "IRPending" + class ProtectedItemState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup state of the backed up item. - """ + """Backup state of the backed up item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -475,9 +488,9 @@ class ProtectedItemState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" + class ProtectionIntentItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """backup protectionIntent type. - """ + """backup protectionIntent type.""" INVALID = "Invalid" AZURE_RESOURCE_ITEM = "AzureResourceItem" @@ -486,9 +499,9 @@ class ProtectionIntentItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_WORKLOAD_AUTO_PROTECTION_INTENT = "AzureWorkloadAutoProtectionIntent" AZURE_WORKLOAD_SQL_AUTO_PROTECTION_INTENT = "AzureWorkloadSQLAutoProtectionIntent" + class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup state of this backup item. - """ + """Backup state of this backup item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -497,9 +510,9 @@ class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" + class ProtectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies whether the container is registered or not - """ + """Specifies whether the container is registered or not.""" INVALID = "Invalid" NOT_PROTECTED = "NotProtected" @@ -507,26 +520,26 @@ class ProtectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROTECTED = "Protected" PROTECTION_FAILED = "ProtectionFailed" + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets or sets provisioning state of the private endpoint connection - """ + """Gets or sets provisioning state of the private endpoint connection.""" SUCCEEDED = "Succeeded" DELETING = "Deleting" FAILED = "Failed" PENDING = "Pending" + class RecoveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines whether the current recovery mode is file restore or database restore - """ + """Defines whether the current recovery mode is file restore or database restore.""" INVALID = "Invalid" FILE_RECOVERY = "FileRecovery" WORKLOAD_RECOVERY = "WorkloadRecovery" + class RecoveryPointTierStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Recovery point tier status. - """ + """Recovery point tier status.""" INVALID = "Invalid" VALID = "Valid" @@ -534,18 +547,18 @@ class RecoveryPointTierStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETED = "Deleted" REHYDRATED = "Rehydrated" + class RecoveryPointTierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Recovery point tier type. - """ + """Recovery point tier type.""" INVALID = "Invalid" INSTANT_RP = "InstantRP" HARDENED_RP = "HardenedRP" ARCHIVED_RP = "ArchivedRP" + class RecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of this recovery. - """ + """Type of this recovery.""" INVALID = "Invalid" ORIGINAL_LOCATION = "OriginalLocation" @@ -553,16 +566,16 @@ class RecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): RESTORE_DISKS = "RestoreDisks" OFFLINE = "Offline" + class RehydrationPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Rehydration Priority - """ + """Rehydration Priority.""" STANDARD = "Standard" HIGH = "High" + class ResourceHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Resource Health Status - """ + """Resource Health Status.""" HEALTHY = "Healthy" TRANSIENT_DEGRADED = "TransientDegraded" @@ -571,9 +584,9 @@ class ResourceHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERSISTENT_UNHEALTHY = "PersistentUnhealthy" INVALID = "Invalid" + class RestorePointQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RestorePoint type - """ + """RestorePoint type.""" INVALID = "Invalid" FULL = "Full" @@ -585,9 +598,9 @@ class RestorePointQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNAPSHOT_FULL = "SnapshotFull" SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" + class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of restore point - """ + """Type of restore point.""" INVALID = "Invalid" FULL = "Full" @@ -597,17 +610,17 @@ class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNAPSHOT_FULL = "SnapshotFull" SNAPSHOT_COPY_ONLY_FULL = "SnapshotCopyOnlyFull" + class RestoreRequestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Restore Type (FullShareRestore or ItemLevelRestore) - """ + """Restore Type (FullShareRestore or ItemLevelRestore).""" INVALID = "Invalid" FULL_SHARE_RESTORE = "FullShareRestore" ITEM_LEVEL_RESTORE = "ItemLevelRestore" + class RetentionDurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Retention duration type of retention policy. - """ + """Retention duration type of retention policy.""" INVALID = "Invalid" DAYS = "Days" @@ -615,42 +628,42 @@ class RetentionDurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MONTHS = "Months" YEARS = "Years" + class RetentionScheduleFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Retention schedule format type for monthly retention policy. - """ + """Retention schedule format type for monthly retention policy.""" INVALID = "Invalid" DAILY = "Daily" WEEKLY = "Weekly" + class ScheduleRunType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Frequency of the schedule operation of this policy. - """ + """Frequency of the schedule operation of this policy.""" INVALID = "Invalid" DAILY = "Daily" WEEKLY = "Weekly" HOURLY = "Hourly" + class SoftDeleteFeatureState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Soft Delete feature state - """ + """Soft Delete feature state.""" INVALID = "Invalid" ENABLED = "Enabled" DISABLED = "Disabled" + class SQLDataDirectoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of data directory mapping - """ + """Type of data directory mapping.""" INVALID = "Invalid" DATA = "Data" LOG = "Log" + class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Storage type - """ + """Storage type.""" INVALID = "Invalid" GEO_REDUNDANT = "GeoRedundant" @@ -658,6 +671,7 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ZONE_REDUNDANT = "ZoneRedundant" READ_ACCESS_GEO_ZONE_REDUNDANT = "ReadAccessGeoZoneRedundant" + class StorageTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. @@ -667,9 +681,9 @@ class StorageTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): LOCKED = "Locked" UNLOCKED = "Unlocked" + class SupportStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Support status of feature - """ + """Support status of feature.""" INVALID = "Invalid" SUPPORTED = "Supported" @@ -677,14 +691,15 @@ class SupportStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEFAULT_ON = "DefaultON" NOT_SUPPORTED = "NotSupported" + 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 + #. DoNotTier: Do not tier any recovery points. """ INVALID = "Invalid" @@ -692,17 +707,17 @@ class TieringMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): TIER_AFTER = "TierAfter" DO_NOT_TIER = "DoNotTier" + class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup management type for this container. - """ + """Backup management type for this container.""" INVALID = "Invalid" BACKUP_PROTECTED_ITEM_COUNT_SUMMARY = "BackupProtectedItemCountSummary" BACKUP_PROTECTION_CONTAINER_COUNT_SUMMARY = "BackupProtectionContainerCountSummary" + class UsagesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Unit of the usage. - """ + """Unit of the usage.""" COUNT = "Count" BYTES = "Bytes" @@ -711,15 +726,17 @@ class UsagesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): COUNT_PER_SECOND = "CountPerSecond" BYTES_PER_SECOND = "BytesPerSecond" + class ValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Validation Status - """ + """Validation Status.""" INVALID = "Invalid" SUCCEEDED = "Succeeded" FAILED = "Failed" + class WeekOfMonth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """WeekOfMonth.""" FIRST = "First" SECOND = "Second" @@ -728,9 +745,9 @@ class WeekOfMonth(str, Enum, metaclass=CaseInsensitiveEnumMeta): LAST = "Last" INVALID = "Invalid" + class WorkloadItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Workload item type of the item for which intent is to be set - """ + """Workload item type of the item for which intent is to be set.""" INVALID = "Invalid" SQL_INSTANCE = "SQLInstance" @@ -741,9 +758,9 @@ class WorkloadItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SAP_ASE_DATABASE = "SAPAseDatabase" SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" + class WorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of workload for the backup management - """ + """Type of workload for the backup management.""" INVALID = "Invalid" VM = "VM" @@ -762,9 +779,9 @@ class WorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SAP_ASE_DATABASE = "SAPAseDatabase" SAP_HANA_DB_INSTANCE = "SAPHanaDBInstance" + class XcoolState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Vault x-cool state - """ + """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 1d6367eb59cd..619214e67304 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 @@ -51,6 +53,7 @@ from ._protection_policy_operation_statuses_operations import ProtectionPolicyOperationStatusesOperations from ._backup_protectable_items_operations import BackupProtectableItemsOperations from ._backup_protection_containers_operations import BackupProtectionContainersOperations +from ._deleted_protection_containers_operations import DeletedProtectionContainersOperations from ._security_pins_operations import SecurityPINsOperations from ._recovery_points_recommended_for_move_operations import RecoveryPointsRecommendedForMoveOperations from ._resource_guard_proxies_operations import ResourceGuardProxiesOperations @@ -59,56 +62,58 @@ 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", + "DeletedProtectionContainersOperations", + "SecurityPINsOperations", + "RecoveryPointsRecommendedForMoveOperations", + "ResourceGuardProxiesOperations", + "ResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_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 5af8e2df29b0..aebc52ba816d 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, @@ -39,43 +48,40 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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, @@ -84,37 +90,35 @@ def build_get_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupEnginesOperations: """ @@ -135,7 +139,6 @@ def __init__(self, *args, **kwargs): 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, @@ -144,47 +147,51 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupEngineBaseResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -192,17 +199,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -219,10 +226,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 @@ -232,11 +237,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( @@ -250,43 +253,45 @@ def get( ) -> _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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupEngineBaseResource] + 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, ) @@ -294,22 +299,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 971d4d086334..4c506d899784 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, @@ -39,36 +48,34 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupJobsOperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,45 +104,49 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -144,17 +154,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -171,10 +181,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 @@ -184,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}/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 2ed2f7f7e158..2f5cf10ddb82 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupOperationResultsOperations: """ @@ -83,14 +85,9 @@ def __init__(self, *args, **kwargs): 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,37 +97,39 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -138,10 +137,9 @@ def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -151,5 +149,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 f97155c21572..0ff78e9d271d 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupOperationStatusesOperations: """ @@ -83,14 +85,9 @@ def __init__(self, *args, **kwargs): 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 + 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 @@ -98,37 +95,39 @@ def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -136,22 +135,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 be0f01363415..9b2471512010 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,52 +26,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, - *, - filter: Optional[str] = None, - **kwargs: Any + vault_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupPoliciesOperations: """ @@ -86,53 +88,52 @@ def __init__(self, *args, **kwargs): 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionPolicyResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -140,16 +141,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -166,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 @@ -179,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}/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 1d8c63bf0208..5b3afbb40df8 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, @@ -39,36 +48,34 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupProtectableItemsOperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,48 +104,52 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.WorkloadProtectableItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -147,17 +157,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -174,10 +184,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 @@ -187,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}/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 7be3781f4380..98fd9cedd224 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, @@ -39,36 +48,34 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupProtectedItemsOperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,46 +104,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectedItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -145,17 +155,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -172,10 +182,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 @@ -185,8 +193,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 eca07afc1dee..5712f3d043aa 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,52 +26,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, - *, - filter: Optional[str] = None, - **kwargs: Any + vault_name: str, resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupProtectionContainersOperations: """ @@ -86,51 +88,50 @@ def __init__(self, *args, **kwargs): 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionContainerResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -138,16 +139,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -164,10 +166,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 +177,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 c12c5d86efb4..bd8d11521688 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, @@ -39,36 +48,34 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupProtectionIntentOperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,46 +104,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionIntentResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -145,17 +155,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -172,10 +182,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 @@ -185,8 +193,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 c070154dbf32..32fa90c672f7 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,93 +24,76 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceEncryptionConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -126,45 +114,43 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] + 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, ) @@ -172,10 +158,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,52 +168,122 @@ 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 - - @distributed_trace + @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. + :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. 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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: Union[_models.BackupResourceEncryptionConfigResource, IO], + **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. Is either a model type or a IO type. + Required. + :type parameters: + ~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) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, @@ -237,7 +292,8 @@ 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, ) @@ -245,10 +301,9 @@ def update( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -259,5 +314,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 cfe6b63dd00c..963b995d7f35 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,138 +24,108 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_patch_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -171,44 +146,40 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceConfigResource] + 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, ) @@ -216,10 +187,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,52 +197,120 @@ 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 - @distributed_trace + @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. + :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. 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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.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] - _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, @@ -281,7 +319,8 @@ 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, ) @@ -289,10 +328,9 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,52 +338,120 @@ 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 - - @distributed_trace + @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. + :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. 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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, @@ -354,7 +460,8 @@ 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, ) @@ -362,10 +469,9 @@ def patch( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -376,5 +482,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 82261164bbc1..1cec46727fa2 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,138 +24,108 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceVaultConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_put_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceVaultConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -171,44 +146,42 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceVaultConfigResource] + 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, ) @@ -216,10 +189,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,52 +199,120 @@ 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 - - @distributed_trace + @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. + :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. 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) + :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: + """ + + @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: Union[_models.BackupResourceVaultConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupResourceVaultConfigResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceVaultConfigResource] + 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, @@ -281,7 +321,8 @@ 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, ) @@ -289,10 +330,9 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,52 +340,120 @@ 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 - @distributed_trace + @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. + :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. 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: Union[_models.BackupResourceVaultConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceVaultConfigResource] + 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, @@ -354,7 +462,8 @@ 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, ) @@ -362,10 +471,9 @@ def put( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,12 +481,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 9a46682e129a..170844b2df3d 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,54 +24,46 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, - *, - json: Optional[_models.BackupStatusRequest] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -87,40 +84,97 @@ def __init__(self, *args, **kwargs): 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, + *, + 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. + :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) + :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: + """ + + @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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupStatusResponse] + 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, @@ -128,7 +182,8 @@ 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, ) @@ -136,22 +191,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 27d1aaa08ad0..e77f67dfdca0 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, @@ -39,36 +48,34 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupUsageSummariesOperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,46 +104,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupManagementUsageList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -145,17 +155,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -172,10 +182,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 @@ -185,8 +193,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 bb29311c0f19..82a210e11d7a 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,19 +26,22 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, + subscription_id: str, *, filter: Optional[str] = None, skip_token: Optional[str] = None, @@ -41,38 +50,36 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupWorkloadItemsOperations: """ @@ -93,7 +100,6 @@ def __init__(self, *args, **kwargs): 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, @@ -104,54 +110,58 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.WorkloadItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -159,19 +169,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -188,10 +196,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 @@ -201,8 +207,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 0d247810b836..ebf0ee88c1ac 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,62 +24,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_trigger_request( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_name: str, protected_item_name: str, - *, - json: Optional[_models.BackupRequestResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -95,6 +96,83 @@ def __init__(self, *args, **kwargs): 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 @@ -104,56 +182,70 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, 'BackupRequestResource') + 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, ) @@ -161,10 +253,9 @@ def trigger( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -174,5 +265,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 da9f0cb55700..bceb1960673f 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BMSPrepareDataMoveOperationResultOperations: """ @@ -83,50 +85,47 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] + 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, ) @@ -134,10 +133,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -147,12 +145,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/_deleted_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py new file mode 100644 index 000000000000..311e45520ddf --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py @@ -0,0 +1,182 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import 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( + resource_group_name: str, vault_name: str, subscription_id: str, *, filter: Optional[str] = None, **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-09-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}/backupDeletedProtectionContainers", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DeletedProtectionContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.recoveryservicesbackup.activestamp.RecoveryServicesBackupClient`'s + :attr:`deleted_protection_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ProtectionContainerResource"]: + """Lists the soft deleted containers registered to Recovery Services Vault. + + :param resource_group_name: The name of the resource group where the recovery services vault is + present. Required. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. Required. + :type vault_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 ProtectionContainerResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + filter=filter, + 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) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProtectionContainerResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers"} # 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 a7a91effc5a9..c9f3cb6ba229 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ExportJobsOperationResultsOperations: """ @@ -83,51 +85,48 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationResultInfoBaseResource] + 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, ) @@ -135,10 +134,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -146,15 +144,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 dd8242022910..79f530ef9c23 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,54 +24,46 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_validate_request( - azure_region: str, - subscription_id: str, - *, - json: Optional[_models.FeatureSupportRequest] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -87,41 +84,100 @@ def __init__(self, *args, **kwargs): 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, + *, + content_type: str = "application/json", **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. + :param azure_region: Azure region to hit Api. Required. + :type azure_region: str + :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) + :rtype: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.AzureVMResourceFeatureSupportResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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. + + 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. + :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) + :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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AzureVMResourceFeatureSupportResponse] + 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] - _json = self._serialize.body(parameters, 'FeatureSupportRequest') + 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, @@ -129,7 +185,8 @@ 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, ) @@ -137,22 +194,20 @@ def validate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 978d0944cac8..a579c5b6eeff 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,109 +24,102 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_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: Optional[_models.ILRRequestResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ItemLevelRecoveryConnectionsOperations: """ @@ -142,8 +140,7 @@ def __init__(self, *args, **kwargs): 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, @@ -153,6 +150,8 @@ def provision( # pylint: disable=inconsistent-return-statements protected_item_name: str, recovery_point_id: str, 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,54 +160,161 @@ 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 + 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -216,10 +322,9 @@ def provision( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -229,8 +334,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 @@ -247,48 +351,51 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -296,10 +403,9 @@ def revoke( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -309,5 +415,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 8b666beb882c..d43736bcbc0c 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class JobCancellationsOperations: """ @@ -83,49 +85,46 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -133,10 +132,9 @@ def trigger( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -146,5 +144,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 308773b508d3..43359b52029b 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class JobDetailsOperations: """ @@ -83,48 +85,43 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResource] + 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, ) @@ -132,22 +129,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 6714841270f7..cfa4e6b2749e 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,52 +24,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class JobOperationResultsOperations: """ @@ -85,52 +86,49 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -138,10 +136,9 @@ def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -151,5 +148,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 468808103c24..5b9f752ecb07 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,52 +24,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class JobsOperations: """ @@ -85,48 +86,45 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -134,10 +132,9 @@ def export( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -147,5 +144,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 cbb9792dda6e..578749cf1819 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +24,49 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_validate_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.ValidateOperationRequest] = None, - content: Any = None, - **kwargs: Any + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -89,43 +87,112 @@ def __init__(self, *args, **kwargs): 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, + *, + 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. + :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) + :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: + """ + + @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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationsResponse + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ValidateOperationsResponse] + 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, @@ -134,7 +201,8 @@ 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, ) @@ -142,22 +210,20 @@ def validate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 e1441078420c..d7e51230ee06 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,38 +26,34 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _convert_request -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( - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.RecoveryServices/operations") # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class Operations: """ @@ -72,37 +74,37 @@ def __init__(self, *args, **kwargs): 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ClientDiscoveryResponse] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -110,12 +112,17 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) # type: ignore else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -132,10 +139,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 @@ -145,8 +150,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/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py index b1de1a386d66..39d76e383ede 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,11 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,136 +26,132 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( vault_name: str, resource_group_name: str, - subscription_id: str, private_endpoint_connection_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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.PrivateEndpointConnectionResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointConnectionOperations: """ @@ -171,48 +172,45 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionResource] + 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, ) @@ -220,10 +218,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -231,47 +228,56 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionResource] + 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] - _json = self._serialize.body(parameters, '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_initial( + 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, ) @@ -279,10 +285,9 @@ def _put_initial( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -290,40 +295,123 @@ 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 - @distributed_trace + @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. + :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. 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( + self, + vault_name: str, + resource_group_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnectionResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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 @@ -336,20 +424,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -358,66 +443,60 @@ def begin_put( 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): - 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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -425,10 +504,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -438,25 +516,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. @@ -468,53 +541,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: """ _headers = 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 - 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] + 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( # 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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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 e71a7d2fb247..a6ba01621c4f 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,52 +24,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class PrivateEndpointOperations: """ @@ -85,7 +93,6 @@ def __init__(self, *args, **kwargs): 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( self, @@ -99,40 +106,42 @@ def get_operation_status( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -140,10 +149,9 @@ def get_operation_status( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -151,12 +159,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 8e7512f279c3..f37154db6ac8 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,18 +26,21 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, + subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any @@ -39,35 +48,33 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectableContainersOperations: """ @@ -88,55 +95,53 @@ def __init__(self, *args, **kwargs): 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectableContainerResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -144,17 +149,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -171,10 +176,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 @@ -184,8 +187,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 04b5b5ee4c44..bd80d5a2c65b 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +24,57 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectedItemOperationResultsOperations: """ @@ -89,7 +95,6 @@ def __init__(self, *args, **kwargs): 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, @@ -103,47 +108,49 @@ def get( ) -> 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ProtectedItemResource]] + 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, ) @@ -151,10 +158,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -163,12 +169,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 8076662ca2d8..3813f8a48ed2 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +24,57 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectedItemOperationStatusesOperations: """ @@ -89,7 +95,6 @@ def __init__(self, *args, **kwargs): 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, @@ -107,46 +112,49 @@ def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -154,22 +162,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 dc8d70bb9997..8b82269e40ef 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,20 +24,23 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( 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 @@ -40,131 +48,118 @@ def build_get_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.ProtectedItemResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectedItemsOperations: """ @@ -185,7 +180,6 @@ def __init__(self, *args, **kwargs): 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, @@ -201,46 +195,48 @@ def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectedItemResource] + 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, ) @@ -248,25 +244,103 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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( @@ -276,7 +350,7 @@ 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]: """Enables backup of an item or to modifies the backup policy information of an already backed up @@ -284,49 +358,63 @@ def create_or_update( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.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]] - _json = self._serialize.body(parameters, '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, ) @@ -334,10 +422,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -346,15 +433,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 @@ -370,43 +456,45 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -414,10 +502,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -427,5 +514,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 e172b0f178b2..1edcec69f405 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,54 +24,55 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectionContainerOperationResultsOperations: """ @@ -87,7 +93,6 @@ def __init__(self, *args, **kwargs): 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, @@ -100,45 +105,47 @@ def get( ) -> 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + 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, ) @@ -146,10 +153,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -158,12 +164,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 4b3f2cb399e2..5f605cf60c0d 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,52 +24,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectionContainerRefreshOperationResultsOperations: """ @@ -85,53 +86,49 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -139,10 +136,9 @@ def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -152,5 +148,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 fe472750ffff..d367044f2236 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,150 +24,139 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( vault_name: str, resource_group_name: str, - subscription_id: str, fabric_name: str, container_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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.ProtectionContainerResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **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 @@ -170,43 +164,40 @@ def build_inquire_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **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 @@ -214,35 +205,33 @@ def build_refresh_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectionContainersOperations: """ @@ -263,52 +252,48 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionContainerResource] + 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, ) @@ -316,27 +301,25 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace + @overload def register( self, vault_name: str, @@ -344,6 +327,8 @@ def register( 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. @@ -351,48 +336,136 @@ def register( 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. 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( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + parameters: Union[_models.ProtectionContainerResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.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]] - _json = self._serialize.body(parameters, '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, ) @@ -400,10 +473,9 @@ def register( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -412,65 +484,61 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -478,10 +546,9 @@ def unregister( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -491,8 +558,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 @@ -509,43 +575,45 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -553,10 +621,9 @@ def inquire( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -566,57 +633,53 @@ 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -624,10 +687,9 @@ def refresh( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -637,5 +699,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 32ff51d74429..ac95305794a8 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,178 +24,157 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_validate_request( - azure_region: str, - subscription_id: str, - *, - json: Optional[_models.PreValidateEnableBackupRequest] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.ProtectionIntentResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) class ProtectionIntentOperations: """ @@ -211,12 +195,13 @@ def __init__(self, *args, **kwargs): 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, + *, + content_type: str = "application/json", **kwargs: Any ) -> _models.PreValidateEnableBackupResponse: """It will validate followings @@ -233,29 +218,105 @@ 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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PreValidateEnableBackupResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + 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) + :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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.PreValidateEnableBackupResponse] + 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] - _json = self._serialize.body(parameters, 'PreValidateEnableBackupRequest') + 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, @@ -263,7 +324,8 @@ 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, ) @@ -271,73 +333,68 @@ def validate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionIntentResource] + 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, ) @@ -345,27 +402,25 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace + @overload def create_or_update( self, vault_name: str, @@ -373,51 +428,133 @@ def create_or_update( 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. + :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. 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) + :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: + """ + + @distributed_trace + def create_or_update( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + intent_object_name: str, + parameters: Union[_models.ProtectionIntentResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.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] - _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, ) @@ -425,71 +562,66 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -497,10 +629,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -510,5 +641,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 b2b1134cab82..f596f7b8f2ec 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,11 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,136 +26,114 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.ProtectionPolicyResource] = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, policy_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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectionPoliciesOperations: """ @@ -171,50 +154,47 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionPolicyResource] + 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, ) @@ -222,77 +202,155 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace + @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. + :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. 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( + self, + vault_name: str, + resource_group_name: str, + policy_name: str, + parameters: Union[_models.ProtectionPolicyResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.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]] - _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, ) @@ -300,10 +358,9 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -312,42 +369,39 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -355,10 +409,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -368,27 +421,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. @@ -400,53 +448,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: """ _headers = 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 - 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] + 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( # 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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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 f0295ffa17ef..5e2ade0c55ac 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,52 +24,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectionPolicyOperationResultsOperations: """ @@ -85,53 +86,49 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectionPolicyResource] + 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, ) @@ -139,22 +136,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 026770a6e83a..b27528dddf71 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,52 +24,48 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ProtectionPolicyOperationStatusesOperations: """ @@ -85,15 +86,9 @@ def __init__(self, *args, **kwargs): 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 + 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 @@ -101,41 +96,43 @@ def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -143,22 +140,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 7c74e6917e37..89de00aa4908 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,20 +26,23 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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 @@ -41,82 +50,77 @@ def build_list_request( _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class RecoveryPointsOperations: """ @@ -137,7 +141,6 @@ def __init__(self, *args, **kwargs): 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, @@ -148,52 +151,56 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -201,19 +208,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -230,10 +235,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 @@ -243,11 +246,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( @@ -264,46 +265,50 @@ def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResource] + 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, ) @@ -311,22 +316,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 16bd610e3bf5..b549290a7ade 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,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,62 +26,58 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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, - *, - json: Optional[_models.ListRecoveryPointsRecommendedForMoveRequest] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -96,6 +98,84 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def list( + self, + vault_name: str, + resource_group_name: str, + fabric_name: str, + container_name: str, + protected_item_name: str, + parameters: _models.ListRecoveryPointsRecommendedForMoveRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable["_models.RecoveryPointResource"]: + """Lists the recovery points recommended for move to another tier. + + :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 parameters: List Recovery points Recommended for Move Request. Required. + :type parameters: + ~azure.mgmt.recoveryservicesbackup.activestamp.models.ListRecoveryPointsRecommendedForMoveRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + 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 + ) -> Iterable["_models.RecoveryPointResource"]: + """Lists the recovery points recommended for move to another tier. + + :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 parameters: List Recovery points Recommended for 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 + :return: An iterator like instance of either RecoveryPointResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def list( @@ -105,58 +185,74 @@ 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: """ _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', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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") + def prepare_request(next_link=None): if not next_link: - _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, ) @@ -164,21 +260,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -195,10 +287,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 @@ -208,8 +298,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 22c79efbab1b..d3715d1164c1 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,11 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,237 +26,201 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.PrepareDataMoveRequest] = 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: Optional[_models.TriggerDataMoveRequest] = 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: Optional[_models.MoveRPAcrossTiersRequest] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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 RecoveryServicesBackupClientOperationsMixin(MixinABC): +class RecoveryServicesBackupClientOperationsMixin(MixinABC): @distributed_trace def get_operation_status( - 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 ) -> _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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -259,10 +228,9 @@ def get_operation_status( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,45 +238,54 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -316,39 +293,112 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 @@ -359,20 +409,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -380,67 +427,73 @@ def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statemen 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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, 'TriggerDataMoveRequest') + 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_initial( + 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, ) @@ -448,39 +501,112 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 @@ -491,20 +617,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -512,37 +635,33 @@ def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statemen 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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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, @@ -552,35 +671,45 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -588,10 +717,9 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -601,11 +729,10 @@ 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 - @distributed_trace - def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements + @overload + def begin_move_recovery_point( self, vault_name: str, resource_group_name: str, @@ -614,28 +741,82 @@ def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements 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. + :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. 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 @@ -646,20 +827,66 @@ 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: + """ + + @distributed_trace + 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: 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. 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. Is either a model type or a IO type. + Required. + :type parameters: + ~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 + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -671,34 +898,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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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 5baafaf041c5..30d86ae135ca 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,48 +26,44 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ResourceGuardProxiesOperations: """ @@ -82,47 +84,47 @@ def __init__(self, *args, **kwargs): 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceGuardProxyBaseResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -130,15 +132,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -155,10 +159,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 @@ -168,8 +170,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 9058b2439141..35fac08766c5 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,183 +24,149 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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/{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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.ResourceGuardProxyBaseResource] = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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/{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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **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: Optional[_models.UnlockDeleteRequest] = None, - content: Any = None, - **kwargs: Any + vault_name: str, resource_group_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -216,48 +187,45 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + 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, ) @@ -265,76 +233,152 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 - @distributed_trace + @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. + :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. 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( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + 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, ) @@ -342,67 +386,63 @@ def put( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -410,10 +450,9 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -423,57 +462,132 @@ 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 - @distributed_trace + @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. + :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. 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) + :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: + """ + + @distributed_trace + def unlock_delete( + self, + vault_name: str, + resource_group_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, IO], + **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. 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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.UnlockDeleteResponse] + 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, ) @@ -481,22 +595,20 @@ def unlock_delete( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 9ef499a93aef..616120229886 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,11 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,64 +26,60 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_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: Optional[_models.RestoreRequestResource] = None, - content: Any = None, + 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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -99,7 +100,6 @@ def __init__(self, *args, **kwargs): 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, @@ -108,35 +108,45 @@ 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -144,10 +154,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -157,11 +166,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, @@ -169,28 +277,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 @@ -201,20 +314,17 @@ 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: """ _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', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -226,34 +336,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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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 e3408704b71c..6a7a67dd7d6f 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,56 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.SecurityPinBase] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -89,45 +85,113 @@ def __init__(self, *args, **kwargs): 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, + *, + content_type: str = "application/json", **kwargs: Any ) -> _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) + :rtype: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TokenInformation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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. + + :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) + :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: + """ + + @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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.TokenInformation] + 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] - if parameters is not None: - _json = self._serialize.body(parameters, 'SecurityPinBase') + 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, @@ -136,7 +200,8 @@ 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, ) @@ -144,22 +209,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 fc124ccc1810..1e5dd22a65aa 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,11 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,56 +26,49 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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_trigger_request_initial( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.ValidateOperationRequest] = None, - content: Any = None, - **kwargs: Any + +def build_trigger_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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -91,36 +89,45 @@ def __init__(self, *args, **kwargs): 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -128,10 +135,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [202]: @@ -141,28 +147,68 @@ 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 - @distributed_trace - def begin_trigger( # pylint: disable=inconsistent-return-statements + @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. + :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 + :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 @@ -173,20 +219,53 @@ 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: + """ + + @distributed_trace + def begin_trigger( + self, + vault_name: str, + resource_group_name: str, + 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. 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 + :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', "2022-06-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # 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] + 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( # type: ignore vault_name=vault_name, @@ -194,34 +273,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 = cast(PollingMethod, ARMPolling( - lro_delay, - - - **kwargs - )) # type: PollingMethod - elif polling is False: polling_method = cast(PollingMethod, NoPolling()) - else: polling_method = polling + 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 1ec2c3c01e8d..4b67715ddd84 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ValidateOperationResultsOperations: """ @@ -83,50 +85,47 @@ def __init__(self, *args, **kwargs): 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ValidateOperationsResponse]] + 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, ) @@ -134,10 +133,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -146,12 +144,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 708366996801..cc500b57ff3a 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._serialization import Serializer from .._vendor import MixinABC, _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( - 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: _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") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ValidateOperationStatusesOperations: """ @@ -83,14 +85,9 @@ def __init__(self, *args, **kwargs): 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 + 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 @@ -98,37 +95,40 @@ def get( 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2022-06-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -136,22 +136,20 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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 08e0ce8e34bd..448b2d35b56a 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 @@ -17,7 +17,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['RecoveryServicesBackupPassiveClient'] + +__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 e00c358e98dc..c82a5eaf3b4e 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/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py index 87b912c3fb7c..3582f46e5533 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,7 +90,9 @@ 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)} @@ -88,27 +102,21 @@ def __init__( 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.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.backup_crr_jobs = BackupCrrJobsOperations( - 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.recovery_points = RecoveryPointsOperations( - 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 ) @@ -119,12 +127,7 @@ def __init__( 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 @@ -133,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 000000000000..7c1dedb5133d --- /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.debug( + "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 138f663c53a4..9aad73fc743e 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/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py index 78e68506dc75..b0c9e9eacd21 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 @@ -14,7 +14,8 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['RecoveryServicesBackupPassiveClient'] + +__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 788c7f059d6c..6269cd3efc88 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/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py index 88ef08098a62..439b1564f711 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,7 +90,9 @@ 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)} @@ -88,27 +102,21 @@ def __init__( 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.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.backup_crr_jobs = BackupCrrJobsOperations( - 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.recovery_points = RecoveryPointsOperations( - 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 ) @@ -119,12 +127,7 @@ def __init__( 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 @@ -133,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 7e81b862ab75..cc07a4210734 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 @@ -21,18 +21,19 @@ 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() \ No newline at end of file +_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 e7325c52d086..bcca4e613a1a 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +26,11 @@ 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: """ .. warning:: @@ -41,45 +50,43 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AADPropertiesResource] + 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, ) @@ -87,10 +94,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,12 +104,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 33f3d1c7abca..1abba25c3415 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +26,11 @@ 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: """ .. warning:: @@ -41,40 +50,95 @@ def __init__(self, *args, **kwargs) -> None: 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, + *, + 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. + :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: + """ + + @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. + + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResource] + 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, @@ -82,7 +146,8 @@ 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, ) @@ -90,10 +155,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,12 +165,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 9889ff39c30e..a379de27cfbb 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,10 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +28,11 @@ 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: """ .. warning:: @@ -42,58 +52,137 @@ def __init__(self, *args, **kwargs) -> None: 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 list( self, azure_region: str, parameters: _models.CrrJobRequest, filter: Optional[str] = None, skip_token: Optional[str] = None, + *, + content_type: str = "application/json", **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. + :param parameters: Backup CRR Job request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + azure_region: str, + parameters: IO, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. Required. + :type azure_region: str + :param parameters: Backup CRR Job request. Required. + :type parameters: IO + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + azure_region: str, + parameters: Union[_models.CrrJobRequest, IO], + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> 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. Required. + :type azure_region: str + :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: """ _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', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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") + def prepare_request(next_link=None): if not next_link: - _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, ) @@ -101,19 +190,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -130,10 +217,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 +229,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 743e74e7fb1b..41e05b9c93cf 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +28,11 @@ 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: """ .. warning:: @@ -42,7 +52,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -51,46 +60,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectedItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -98,17 +111,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -125,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 @@ -139,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}/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 ec12b70814e7..ecca69d8cd15 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,10 +25,16 @@ 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: """ .. warning:: @@ -41,44 +54,42 @@ def __init__(self, *args, **kwargs) -> None: 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 + 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceConfigResource] + 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, ) @@ -86,10 +97,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,52 +107,120 @@ 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 - @distributed_trace_async + @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. + :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. 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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.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] - _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, @@ -151,7 +229,8 @@ 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, ) @@ -159,10 +238,9 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -170,52 +248,120 @@ 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 - @distributed_trace_async + @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. + :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. 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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, @@ -224,7 +370,8 @@ 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, ) @@ -232,10 +379,9 @@ async def patch( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -246,5 +392,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 398e0cbd8448..f8ac66092359 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +28,11 @@ 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: """ .. warning:: @@ -42,7 +52,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -51,46 +60,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupManagementUsageList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -98,17 +111,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -125,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 @@ -139,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}/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 b5b5e6e43a8c..3433497321d4 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,9 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +27,12 @@ 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: """ .. warning:: @@ -43,34 +52,40 @@ def __init__(self, *args, **kwargs) -> None: 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -78,27 +93,28 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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, + *, + 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 @@ -107,11 +123,76 @@ 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 + 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, 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 @@ -122,54 +203,50 @@ 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: """ _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', "application/json")) # 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] + 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( # 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 = 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 + 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 4d679e15e599..291fdc4a802a 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +26,11 @@ 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: """ .. warning:: @@ -41,43 +50,41 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -85,10 +92,9 @@ async def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -99,5 +105,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 1c6a23b6bb72..354710bd1890 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,7 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +26,11 @@ 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: """ .. warning:: @@ -41,43 +50,39 @@ def __init__(self, *args, **kwargs) -> None: 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -85,10 +90,9 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,12 +100,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/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py index 1d31a6b7466c..71a22d238d64 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,9 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,9 +28,11 @@ 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: """ .. warning:: @@ -42,7 +52,6 @@ def __init__(self, *args, **kwargs) -> None: 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, @@ -53,52 +62,56 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -106,19 +119,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -135,10 +146,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 @@ -149,8 +158,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 4896783d6936..2cf3bf5bb936 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,9 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -19,9 +26,11 @@ 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: """ .. warning:: @@ -41,6 +50,89 @@ def __init__(self, *args, **kwargs) -> None: 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( @@ -51,59 +143,74 @@ 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: """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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CrrAccessTokenResource] + 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, ) @@ -111,10 +218,9 @@ async def get_access_token( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,12 +228,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 c89e4f027b35..1536b2168d82 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,194 +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() \ No newline at end of file +_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 f8df0fcaf903..e36298d0b708 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. @@ -9,15 +10,14 @@ import datetime from typing import Dict, List, Optional, TYPE_CHECKING, Union -from azure.core.exceptions import HttpResponseError -import msrest.serialization +from .. import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - import __init__ as _models + from .. import models as _models -class AADProperties(msrest.serialization.Model): +class AADProperties(_serialization.Model): """AADProperties. :ivar service_principal_client_id: @@ -33,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__( @@ -62,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 @@ -70,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. @@ -84,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__( @@ -116,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 @@ -144,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 @@ -153,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__( @@ -180,35 +180,36 @@ 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 :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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -224,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. Known values are: "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 @@ -245,29 +246,37 @@ 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__( @@ -292,12 +301,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -313,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. Known values are: "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. @@ -334,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 @@ -352,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -382,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. Known values are: "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 @@ -405,11 +414,11 @@ class AzureFileshareProtectedItem(ProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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. @@ -425,33 +434,33 @@ 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__( @@ -484,12 +493,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -505,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. Known values are: "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. @@ -530,11 +539,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. Known values are: - "Passed", "ActionRequired", "ActionSuggested", "Invalid". + "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. @@ -548,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 @@ -560,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. @@ -580,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__( @@ -610,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 @@ -618,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] @@ -660,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. @@ -675,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] @@ -744,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. Known values are: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + "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). Known values - are: "Invalid", "FullShareRestore", "ItemLevelRestore". + 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 @@ -771,17 +794,17 @@ 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__( @@ -797,17 +820,17 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. Known values are: "Invalid", - "CreateCopy", "Skip", "Overwrite", "FailOnConflict". + "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). Known - values are: "Invalid", "FullShareRestore", "ItemLevelRestore". + 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 @@ -818,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 @@ -828,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -861,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. Known values are: "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 @@ -887,11 +910,11 @@ class AzureIaaSVMProtectedItem(ProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -915,44 +938,47 @@ 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, "_models.BackupManagementType"]] = None, @@ -986,12 +1012,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -1007,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. Known values are: "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. @@ -1035,11 +1061,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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. 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 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", + "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. Known values are: "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 @@ -1133,11 +1175,11 @@ class AzureIaaSClassicComputeVMProtectedItem(AzureIaaSVMProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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,40 +1203,40 @@ 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, "_models.BackupManagementType"]] = None, @@ -1228,12 +1270,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -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. Known values are: "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. @@ -1277,11 +1319,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :keyword health_details: Health details on this backup item. @@ -1303,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -1337,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. Known values are: "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,11 +1433,11 @@ class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): :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", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :vartype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :ivar health_details: Health details on this backup item. @@ -1391,40 +1461,40 @@ 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, "_models.BackupManagementType"]] = None, @@ -1458,12 +1528,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -1479,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. Known values are: "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,11 +1577,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "ActionRequired", "ActionSuggested", and "Invalid". :paramtype health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.HealthStatus :keyword health_details: Health details on this backup item. @@ -1533,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. @@ -1553,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. @@ -1595,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 @@ -1637,33 +1727,29 @@ 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. @@ -1671,7 +1757,7 @@ class Job(msrest.serialization.Model): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -1684,28 +1770,34 @@ 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__( @@ -1726,7 +1818,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -1740,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 @@ -1751,7 +1843,7 @@ 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. @@ -1760,7 +1852,7 @@ class AzureIaaSVMJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -1773,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 @@ -1793,23 +1885,23 @@ 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__( @@ -1835,7 +1927,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -1863,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 @@ -1872,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. @@ -1892,12 +1993,12 @@ 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__( @@ -1927,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 @@ -1936,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. @@ -1959,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__( @@ -2001,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 @@ -2012,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. @@ -2025,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__( @@ -2047,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2083,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. Known values are: "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 @@ -2105,7 +2206,7 @@ class AzureSqlProtectedItem(ProtectedItem): contact Recovery Services. :vartype protected_item_data_id: str :ivar protection_state: Backup state of the backed up item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -2114,28 +2215,28 @@ 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__( @@ -2163,12 +2264,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2184,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. Known values are: "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. @@ -2208,21 +2309,37 @@ def __init__( to contact Recovery Services. :paramtype protected_item_data_id: str :keyword protection_state: Backup state of the backed up item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -2234,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__( @@ -2256,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. @@ -2274,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__( @@ -2295,13 +2412,13 @@ 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. @@ -2310,7 +2427,7 @@ class AzureStorageJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -2323,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 @@ -2345,24 +2462,24 @@ 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__( @@ -2389,7 +2506,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -2419,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 @@ -2429,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. @@ -2442,9 +2568,9 @@ 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__( @@ -2464,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. @@ -2480,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2535,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. Known values are: "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 @@ -2565,11 +2686,11 @@ class AzureVmWorkloadProtectedItem(ProtectedItem): :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", "ProtectionPaused". + "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. - Known values are: "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. @@ -2580,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. Known values are: "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 @@ -2593,45 +2714,49 @@ 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, "_models.BackupManagementType"]] = None, @@ -2666,12 +2791,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2687,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. Known values are: "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. @@ -2719,11 +2844,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. - Known values are: "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. @@ -2735,7 +2860,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -2745,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 @@ -2762,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. @@ -2775,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__( @@ -2797,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2833,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. Known values are: "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 @@ -2863,11 +3006,11 @@ class AzureVmWorkloadSAPAseDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :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", "ProtectionPaused". + "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. - Known values are: "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. @@ -2878,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. Known values are: "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 @@ -2891,41 +3034,41 @@ 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, "_models.BackupManagementType"]] = None, @@ -2960,12 +3103,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -2981,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. Known values are: "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. @@ -3013,11 +3156,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. - Known values are: "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. @@ -3029,7 +3172,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -3039,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -3073,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. Known values are: "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 @@ -3103,11 +3277,11 @@ class AzureVmWorkloadSAPHanaDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :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", "ProtectionPaused". + "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. - Known values are: "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. @@ -3118,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. Known values are: "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 @@ -3131,41 +3305,41 @@ 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, "_models.BackupManagementType"]] = None, @@ -3200,12 +3374,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -3221,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. Known values are: "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. @@ -3253,11 +3427,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. - Known values are: "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. @@ -3269,7 +3443,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -3279,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -3313,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. Known values are: "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 @@ -3343,11 +3548,11 @@ class AzureVmWorkloadSQLDatabaseProtectedItem(AzureVmWorkloadProtectedItem): :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", "ProtectionPaused". + "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. - Known values are: "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. @@ -3358,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. Known values are: "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 @@ -3371,41 +3576,41 @@ 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, "_models.BackupManagementType"]] = None, @@ -3440,12 +3645,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -3461,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. Known values are: "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. @@ -3493,11 +3698,11 @@ def __init__( :keyword protection_status: Backup status of this backup item. :paramtype protection_status: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. - Known values are: "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. @@ -3509,7 +3714,7 @@ def __init__( :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", - "IRPending". + and "IRPending". :paramtype protected_item_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemHealthStatus :keyword extended_info: Additional information for this backup item. @@ -3519,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. @@ -3539,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__( @@ -3568,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 @@ -3576,7 +3810,7 @@ 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. @@ -3585,7 +3819,7 @@ class AzureWorkloadJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -3598,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 @@ -3617,23 +3851,23 @@ 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__( @@ -3659,7 +3893,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -3686,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 @@ -3695,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. @@ -3708,9 +3951,9 @@ 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__( @@ -3730,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. @@ -3746,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 @@ -3771,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental". + 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: @@ -3795,21 +4033,28 @@ 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__( @@ -3827,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 @@ -3838,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental". + 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: @@ -3865,22 +4110,25 @@ 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__( @@ -3902,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -3930,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. Known values are: "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 @@ -3940,21 +4193,25 @@ 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__( @@ -3970,7 +4227,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -3982,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. Known values are: "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 @@ -3990,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 @@ -4005,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4020,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. Known values are: "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 @@ -4032,18 +4289,18 @@ 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__( @@ -4060,7 +4317,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4072,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. Known values are: "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 @@ -4082,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 @@ -4094,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental". + 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: @@ -4114,18 +4379,21 @@ 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__( @@ -4147,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4174,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. Known values are: "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 @@ -4184,21 +4457,23 @@ 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__( @@ -4214,7 +4489,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4226,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. Known values are: "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 @@ -4234,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): @@ -4243,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4258,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. Known values are: "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 @@ -4270,18 +4553,18 @@ 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__( @@ -4298,7 +4581,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4310,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. Known values are: "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 @@ -4320,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 @@ -4332,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental". + 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: @@ -4349,17 +4640,20 @@ 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__( @@ -4377,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental". + 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: @@ -4414,22 +4712,25 @@ 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__( @@ -4454,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 @@ -4466,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. Known values are: "Invalid", "Full", "Log", "Differential", - "Incremental". + 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: @@ -4492,19 +4797,22 @@ 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__( @@ -4533,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4561,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. Known values are: "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 @@ -4580,24 +4893,24 @@ 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__( @@ -4616,7 +4929,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4628,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. Known values are: "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 @@ -4645,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4672,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. Known values are: "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 @@ -4693,21 +5016,21 @@ 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__( @@ -4727,7 +5050,7 @@ def __init__( ): """ :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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 @@ -4739,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. Known values are: "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 @@ -4758,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. @@ -4776,51 +5110,47 @@ 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. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond". + "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__( @@ -4836,20 +5166,20 @@ def __init__( ): """ :keyword unit: Unit of the usage. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond". + "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 @@ -4858,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. @@ -4867,37 +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["_models.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. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :vartype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageType :ivar storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "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. Known values are: "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. @@ -4905,10 +5230,10 @@ 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__( @@ -4922,22 +5247,22 @@ def __init__( ): """ :keyword storage_model_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "LocallyRedundant", "ZoneRedundant", and "ReadAccessGeoZoneRedundant". :paramtype storage_model_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.StorageType :keyword storage_type: Storage type. Known values are: "Invalid", "GeoRedundant", - "LocallyRedundant", "ZoneRedundant", "ReadAccessGeoZoneRedundant". + "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. Known values are: "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 @@ -4958,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 @@ -4968,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__( @@ -4995,7 +5320,7 @@ 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 @@ -5003,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. @@ -5019,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__( @@ -5040,71 +5365,63 @@ 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. 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 """ _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, "_models.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. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "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. Known values are: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + "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, "_models.Type"]] = None, - **kwargs - ): + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): """ :keyword type: Backup management type for this container. Known values are: "Invalid", - "BackupProtectedItemCountSummary", "BackupProtectionContainerCountSummary". + "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. @@ -5112,7 +5429,7 @@ class BMSRPQueryObject(msrest.serialization.Model): :ivar end_date: Backup copies created before this time. :vartype end_date: ~datetime.datetime :ivar restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", "Log", - "Differential", "FullAndDifferential", "All", "Incremental". + "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 @@ -5123,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__( @@ -5146,7 +5463,7 @@ def __init__( :keyword end_date: Backup copies created before this time. :paramtype end_date: ~datetime.datetime :keyword restore_point_query_type: RestorePoint type. Known values are: "Invalid", "Full", - "Log", "Differential", "FullAndDifferential", "All", "Incremental". + "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 @@ -5155,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 @@ -5163,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. @@ -5184,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__( @@ -5218,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 @@ -5226,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. @@ -5237,8 +5554,8 @@ 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__( @@ -5256,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 @@ -5275,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 @@ -5285,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__( @@ -5312,7 +5629,7 @@ 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 @@ -5320,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 @@ -5346,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. @@ -5391,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, @@ -5469,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. @@ -5513,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 @@ -5556,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 @@ -5565,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__( @@ -5592,18 +5906,18 @@ 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 :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. @@ -5613,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 @@ -5649,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 @@ -5658,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__( @@ -5685,18 +5993,18 @@ 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 :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. @@ -5707,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. @@ -5725,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: @@ -5740,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. @@ -5772,29 +6070,23 @@ 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. @@ -5803,7 +6095,7 @@ class DpmJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -5816,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 @@ -5841,26 +6133,26 @@ 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__( @@ -5889,7 +6181,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -5922,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 @@ -5934,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. @@ -5947,9 +6248,9 @@ 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__( @@ -5969,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. @@ -5991,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__( @@ -6020,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 @@ -6028,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -6058,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. Known values are: "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 @@ -6081,7 +6382,7 @@ class DPMProtectedItem(ProtectedItem): :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -6090,29 +6391,29 @@ 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__( @@ -6141,12 +6442,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -6162,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. Known values are: "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. @@ -6187,22 +6488,38 @@ def __init__( :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. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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. @@ -6236,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__( @@ -6301,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 @@ -6318,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 @@ -6335,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__( @@ -6365,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 @@ -6373,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. @@ -6381,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. @@ -6419,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. @@ -6451,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["_models.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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -6499,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. Known values are: "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 @@ -6523,11 +6827,11 @@ class GenericProtectedItem(ProtectedItem): item. :vartype policy_state: str :ivar protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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] @@ -6536,31 +6840,31 @@ 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__( @@ -6591,12 +6895,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -6612,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. Known values are: "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. @@ -6638,19 +6942,35 @@ def __init__( item. :paramtype policy_state: str :keyword protection_state: Backup state of this backup item. Known values are: "Invalid", - "IRPending", "Protected", "ProtectionError", "ProtectionStopped", "ProtectionPaused". + "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 @@ -6664,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 @@ -6678,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__( @@ -6709,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 @@ -6768,31 +7088,37 @@ 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__( @@ -6839,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 @@ -6858,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. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. @@ -6932,31 +7258,31 @@ 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__( @@ -6988,7 +7314,7 @@ def __init__( :keyword recovery_point_id: ID of the backup copy to be recovered. :paramtype recovery_point_id: str :keyword recovery_type: Type of this recovery. Known values are: "Invalid", "OriginalLocation", - "AlternateLocation", "RestoreDisks", "Offline". + "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. @@ -7050,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 @@ -7074,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. @@ -7084,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 @@ -7118,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__( @@ -7137,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. @@ -7151,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["_models.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. Known values are: "Invalid", "InProgress", "Completed", - "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + "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. 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. Known values are: "Invalid", "Register", "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :vartype operation: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobOperationType :ivar job_id: JobID represents the job uniquely. @@ -7194,12 +7509,12 @@ 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__( @@ -7215,16 +7530,16 @@ def __init__( ): """ :keyword status: Status of the job. Known values are: "Invalid", "InProgress", "Completed", - "Failed", "CompletedWithWarnings", "Cancelled", "Cancelling". + "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. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: Type of operation. Known values are: "Invalid", "Register", "UnRegister", "ConfigureBackup", "Backup", "Restore", "DisableBackup", "DeleteBackupData", - "CrossRegionRestore", "Undelete", "UpdateCustomerManagedKey". + "CrossRegionRestore", "Undelete", and "UpdateCustomerManagedKey". :paramtype operation: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobOperationType :keyword job_id: JobID represents the job uniquely. @@ -7234,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 @@ -7257,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 @@ -7266,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__( @@ -7293,18 +7608,18 @@ 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 :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 @@ -7313,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 @@ -7342,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["_models.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 @@ -7360,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. @@ -7376,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__( @@ -7397,35 +7703,35 @@ 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__( @@ -7444,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. Known values are: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :vartype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ResourceHealthStatus @@ -7464,8 +7770,8 @@ 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__( @@ -7477,7 +7783,7 @@ def __init__( ): """ :keyword resource_health_status: Resource Health Status. Known values are: "Healthy", - "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", + "TransientDegraded", "PersistentDegraded", "TransientUnhealthy", "PersistentUnhealthy", and "Invalid". :paramtype resource_health_status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.ResourceHealthStatus @@ -7485,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. @@ -7502,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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -7552,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. Known values are: "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 @@ -7581,39 +7883,39 @@ 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__( @@ -7645,12 +7947,12 @@ def __init__( """ :keyword backup_management_type: Type of backup management for the backed up item. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype workload_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -7666,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. Known values are: "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. @@ -7697,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 @@ -7713,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. @@ -7725,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__( @@ -7746,13 +8064,13 @@ 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. @@ -7761,7 +8079,7 @@ class MabJob(Job): :vartype entity_friendly_name: str :ivar backup_management_type: Backup management type to execute the current 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: The operation name. @@ -7774,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 @@ -7787,12 +8105,12 @@ class MabJob(Job): :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", "GenericContainer". + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :vartype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabServerType :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 @@ -7805,25 +8123,25 @@ 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__( @@ -7851,7 +8169,7 @@ def __init__( :paramtype entity_friendly_name: str :keyword backup_management_type: Backup management type to execute the current job. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", - "AzureStorage", "AzureWorkload", "DefaultBackup". + "AzureStorage", "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :keyword operation: The operation name. @@ -7874,12 +8192,12 @@ def __init__( :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", "GenericContainer". + "SQLAGWorkLoadContainer", "StorageContainer", and "GenericContainer". :paramtype mab_server_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.MabServerType :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 @@ -7890,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 @@ -7901,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. @@ -7914,9 +8241,9 @@ 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__( @@ -7936,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. @@ -7958,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__( @@ -7987,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 @@ -7995,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. @@ -8005,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. @@ -8035,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["_models.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. @@ -8071,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 @@ -8100,7 +8412,7 @@ def __init__( self.additional_info = None -class OperationStatus(msrest.serialization.Model): +class OperationStatus(_serialization.Model): """Operation status. :ivar id: ID of the operation. @@ -8108,7 +8420,7 @@ class OperationStatus(msrest.serialization.Model): :ivar name: Name of the operation. :vartype name: str :ivar status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", - "Failed", "Canceled". + "Failed", and "Canceled". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatusValues :ivar start_time: Operation start time. Format: ISO-8601. @@ -8123,19 +8435,19 @@ 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, "_models.OperationStatusValues"]] = None, start_time: Optional[datetime.datetime] = None, @@ -8150,7 +8462,7 @@ def __init__( :keyword name: Name of the operation. :paramtype name: str :keyword status: Operation status. Known values are: "Invalid", "InProgress", "Succeeded", - "Failed", "Canceled". + "Failed", and "Canceled". :paramtype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.OperationStatusValues :keyword start_time: Operation start time. Format: ISO-8601. @@ -8163,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 @@ -8173,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. @@ -8183,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] @@ -8245,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 @@ -8281,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] @@ -8291,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. @@ -8314,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 @@ -8325,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: @@ -8334,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["_models.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 @@ -8363,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: @@ -8375,13 +8669,13 @@ 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__( @@ -8399,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. @@ -8415,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. @@ -8432,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. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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. 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 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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :vartype item_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -8470,15 +8760,15 @@ 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__( @@ -8497,17 +8787,17 @@ def __init__( ): """ :keyword health_state: Health State for the backed up item. Known values are: "Passed", - "ActionRequired", "ActionSuggested", "Invalid". + "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. Known values are: "Invalid", "AzureIaasVM", "MAB", "DPM", "AzureBackupServer", "AzureSql", "AzureStorage", - "AzureWorkload", "DefaultBackup". + "AzureWorkload", and "DefaultBackup". :paramtype backup_management_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementType :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", + "Client", "GenericDataSource", "SQLDataBase", "AzureFileShare", "SAPHanaDatabase", and "SAPAseDatabase". :paramtype item_type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.DataSourceType @@ -8524,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 @@ -8550,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 @@ -8559,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__( @@ -8586,14 +8876,14 @@ 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 :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 @@ -8609,8 +8899,8 @@ 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__( @@ -8628,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. @@ -8648,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__( @@ -8675,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: @@ -8692,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 @@ -8728,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 @@ -8737,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__( @@ -8764,14 +9048,14 @@ 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 :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 @@ -8787,8 +9071,8 @@ 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__( @@ -8806,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. Known values are: "Invalid", "InstantRP", "HardenedRP", - "ArchivedRP". + and "ArchivedRP". :vartype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierType :ivar status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", - "Deleted", "Rehydrated". + "Deleted", and "Rehydrated". :vartype status: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierStatus :ivar extended_info: Recovery point tier status. @@ -8826,9 +9110,9 @@ 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__( @@ -8841,23 +9125,23 @@ def __init__( ): """ :keyword type: Recovery point tier type. Known values are: "Invalid", "InstantRP", - "HardenedRP", "ArchivedRP". + "HardenedRP", and "ArchivedRP". :paramtype type: str or ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointTierType :keyword status: Recovery point tier status. Known values are: "Invalid", "Valid", "Disabled", - "Deleted", "Rehydrated". + "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. @@ -8869,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__( @@ -8890,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. Known values are: "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. @@ -8909,9 +9193,9 @@ 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__( @@ -8923,7 +9207,7 @@ def __init__( **kwargs ): """ - :keyword type: Type of data directory mapping. Known values are: "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. @@ -8931,16 +9215,17 @@ 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. Known values are: "Invalid", "Data", "Log". + :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 :ivar source_logical_name: Restore source logical name path. @@ -8952,10 +9237,10 @@ 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__( @@ -8968,7 +9253,7 @@ def __init__( **kwargs ): """ - :keyword mapping_type: Type of data directory mapping. Known values are: "Invalid", "Data", + :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 @@ -8979,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. @@ -8996,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. Known values are: - "Invalid", "FailOnConflict", "Overwrite". + "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. @@ -9035,10 +9314,10 @@ 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__( @@ -9052,7 +9331,7 @@ def __init__( ): """ :keyword overwrite_option: Can Overwrite if Target DataBase already exists. Known values are: - "Invalid", "FailOnConflict", "Overwrite". + "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. @@ -9063,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 @@ -9089,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. @@ -9152,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, @@ -9244,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. @@ -9306,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/_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 4fc87041469a..2310d3355834 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 @@ -11,8 +11,7 @@ class BackupManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup management type to execute the current job. - """ + """Backup management type to execute the current job.""" INVALID = "Invalid" AZURE_IAAS_VM = "AzureIaasVM" @@ -24,9 +23,9 @@ class BackupManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_WORKLOAD = "AzureWorkload" DEFAULT_BACKUP = "DefaultBackup" + class CopyOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Options to resolve copy conflicts. - """ + """Options to resolve copy conflicts.""" INVALID = "Invalid" CREATE_COPY = "CreateCopy" @@ -34,6 +33,7 @@ class CopyOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): OVERWRITE = "Overwrite" FAIL_ON_CONFLICT = "FailOnConflict" + class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Create mode to indicate recovery of existing soft deleted data source or creation of new data source. @@ -43,9 +43,9 @@ class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): DEFAULT = "Default" RECOVER = "Recover" + class DataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of workload this item represents. - """ + """Type of workload this item represents.""" INVALID = "Invalid" VM = "VM" @@ -63,27 +63,27 @@ class DataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SAP_HANA_DATABASE = "SAPHanaDatabase" SAP_ASE_DATABASE = "SAPAseDatabase" + class HealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Health State for the backed up item. - """ + """Health State for the backed up item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" + class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """backups running status for this backup item. - """ + """backups running status for this backup item.""" PASSED = "Passed" ACTION_REQUIRED = "ActionRequired" ACTION_SUGGESTED = "ActionSuggested" INVALID = "Invalid" + class JobOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of operation. - """ + """Type of operation.""" INVALID = "Invalid" REGISTER = "Register" @@ -97,9 +97,9 @@ class JobOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNDELETE = "Undelete" UPDATE_CUSTOMER_MANAGED_KEY = "UpdateCustomerManagedKey" + class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the job. - """ + """Status of the job.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -109,24 +109,26 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELLED = "Cancelled" CANCELLING = "Cancelling" + class JobSupportedAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """JobSupportedAction.""" INVALID = "Invalid" CANCELLABLE = "Cancellable" RETRIABLE = "Retriable" + class LastBackupStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Last backup operation status. Possible values: Healthy, Unhealthy. - """ + """Last backup operation status. Possible values: Healthy, Unhealthy.""" INVALID = "Invalid" HEALTHY = "Healthy" UNHEALTHY = "Unhealthy" IR_PENDING = "IRPending" + class MabServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Server type of MAB container. - """ + """Server type of MAB container.""" INVALID = "Invalid" UNKNOWN = "Unknown" @@ -144,9 +146,9 @@ class MabServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): STORAGE_CONTAINER = "StorageContainer" GENERIC_CONTAINER = "GenericContainer" + class OperationStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Operation status. - """ + """Operation status.""" INVALID = "Invalid" IN_PROGRESS = "InProgress" @@ -154,17 +156,17 @@ class OperationStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" CANCELED = "Canceled" + class OverwriteOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Can Overwrite if Target DataBase already exists - """ + """Can Overwrite if Target DataBase already exists.""" INVALID = "Invalid" FAIL_ON_CONFLICT = "FailOnConflict" OVERWRITE = "Overwrite" + class ProtectedItemHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Health status of the backup item, evaluated based on last heartbeat received - """ + """Health status of the backup item, evaluated based on last heartbeat received.""" INVALID = "Invalid" HEALTHY = "Healthy" @@ -172,9 +174,9 @@ class ProtectedItemHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_REACHABLE = "NotReachable" IR_PENDING = "IRPending" + class ProtectedItemState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup state of the backed up item. - """ + """Backup state of the backed up item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -183,9 +185,9 @@ class ProtectedItemState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" + class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup state of this backup item. - """ + """Backup state of this backup item.""" INVALID = "Invalid" IR_PENDING = "IRPending" @@ -194,17 +196,17 @@ class ProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PROTECTION_STOPPED = "ProtectionStopped" PROTECTION_PAUSED = "ProtectionPaused" + class RecoveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines whether the current recovery mode is file restore or database restore - """ + """Defines whether the current recovery mode is file restore or database restore.""" INVALID = "Invalid" FILE_RECOVERY = "FileRecovery" WORKLOAD_RECOVERY = "WorkloadRecovery" + class RecoveryPointTierStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Recovery point tier status. - """ + """Recovery point tier status.""" INVALID = "Invalid" VALID = "Valid" @@ -212,18 +214,18 @@ class RecoveryPointTierStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETED = "Deleted" REHYDRATED = "Rehydrated" + class RecoveryPointTierType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Recovery point tier type. - """ + """Recovery point tier type.""" INVALID = "Invalid" INSTANT_RP = "InstantRP" HARDENED_RP = "HardenedRP" ARCHIVED_RP = "ArchivedRP" + class RecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of this recovery. - """ + """Type of this recovery.""" INVALID = "Invalid" ORIGINAL_LOCATION = "OriginalLocation" @@ -231,9 +233,9 @@ class RecoveryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): RESTORE_DISKS = "RestoreDisks" OFFLINE = "Offline" + class ResourceHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Resource Health Status - """ + """Resource Health Status.""" HEALTHY = "Healthy" TRANSIENT_DEGRADED = "TransientDegraded" @@ -242,9 +244,9 @@ class ResourceHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERSISTENT_UNHEALTHY = "PersistentUnhealthy" INVALID = "Invalid" + class RestorePointQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RestorePoint type - """ + """RestorePoint type.""" INVALID = "Invalid" FULL = "Full" @@ -254,9 +256,9 @@ class RestorePointQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "All" INCREMENTAL = "Incremental" + class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of restore point - """ + """Type of restore point.""" INVALID = "Invalid" FULL = "Full" @@ -264,25 +266,25 @@ class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): DIFFERENTIAL = "Differential" INCREMENTAL = "Incremental" + class RestoreRequestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Restore Type (FullShareRestore or ItemLevelRestore) - """ + """Restore Type (FullShareRestore or ItemLevelRestore).""" INVALID = "Invalid" FULL_SHARE_RESTORE = "FullShareRestore" ITEM_LEVEL_RESTORE = "ItemLevelRestore" + class SQLDataDirectoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of data directory mapping - """ + """Type of data directory mapping.""" INVALID = "Invalid" DATA = "Data" LOG = "Log" + class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Storage type - """ + """Storage type.""" INVALID = "Invalid" GEO_REDUNDANT = "GeoRedundant" @@ -290,6 +292,7 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ZONE_REDUNDANT = "ZoneRedundant" READ_ACCESS_GEO_ZONE_REDUNDANT = "ReadAccessGeoZoneRedundant" + class StorageTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Locked or Unlocked. Once a machine is registered against a resource, the storageTypeState is always Locked. @@ -299,17 +302,17 @@ class StorageTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): LOCKED = "Locked" UNLOCKED = "Unlocked" + class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup management type for this container. - """ + """Backup management type for this container.""" INVALID = "Invalid" BACKUP_PROTECTED_ITEM_COUNT_SUMMARY = "BackupProtectedItemCountSummary" BACKUP_PROTECTION_CONTAINER_COUNT_SUMMARY = "BackupProtectionContainerCountSummary" + class UsagesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Unit of the usage. - """ + """Unit of the usage.""" COUNT = "Count" BYTES = "Bytes" @@ -318,9 +321,9 @@ class UsagesUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): COUNT_PER_SECOND = "CountPerSecond" BYTES_PER_SECOND = "BytesPerSecond" + class WorkloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Workload type of backup item. - """ + """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 7e81b862ab75..cc07a4210734 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 @@ -21,18 +21,19 @@ 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() \ No newline at end of file +_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 9422c8e5505e..9aae6ca5aa52 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,50 +24,47 @@ 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: _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") + 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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class AadPropertiesOperations: """ @@ -83,45 +85,41 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AADPropertiesResource] + 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, ) @@ -129,10 +127,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,12 +137,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 1b2e9aaeb641..ef2a207381dd 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,54 +24,46 @@ 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, - *, - json: Optional[_models.CrrJobRequest] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -87,40 +84,95 @@ def __init__(self, *args, **kwargs): 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, + *, + 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. + :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) + :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: + """ + + @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) + :rtype: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResource] + 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, @@ -128,7 +180,8 @@ 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, ) @@ -136,10 +189,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -147,12 +199,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 af4313d408db..a4e3536c3185 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,11 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,19 +26,20 @@ 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( azure_region: str, subscription_id: str, *, - json: Optional[_models.CrrJobRequest] = None, - content: Any = None, filter: Optional[str] = None, skip_token: Optional[str] = None, **kwargs: Any @@ -40,40 +47,36 @@ def build_list_request( _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") + 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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -94,58 +97,137 @@ def __init__(self, *args, **kwargs): 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 list( self, azure_region: str, parameters: _models.CrrJobRequest, filter: Optional[str] = None, skip_token: Optional[str] = None, + *, + content_type: str = "application/json", **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. + :param parameters: Backup CRR Job request. Required. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest :param filter: OData filter options. Default value is None. :type filter: str :param skip_token: skipToken Filter. Default value is None. :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + azure_region: str, + parameters: IO, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. Required. + :type azure_region: str + :param parameters: Backup CRR Job request. Required. + :type parameters: IO + :param filter: OData filter options. Default value is None. + :type filter: str + :param skip_token: skipToken Filter. Default value is None. + :type skip_token: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either 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: + """ + + @distributed_trace + def list( + self, + azure_region: str, + parameters: Union[_models.CrrJobRequest, IO], + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> 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. Required. + :type azure_region: str + :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 JobResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResource] + :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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.JobResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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") + def prepare_request(next_link=None): if not next_link: - _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, ) @@ -153,19 +235,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -182,10 +262,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 @@ -196,8 +274,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 729231483545..6983263dd796 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ 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, @@ -39,36 +48,34 @@ def build_list_request( _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") + 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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupProtectedItemsCrrOperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,46 +104,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.ProtectedItemResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -145,17 +155,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -172,10 +182,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 @@ -186,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}/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 1c973853025e..fdb9b2876202 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,138 +24,108 @@ 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( - vault_name: str, - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + +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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_update_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) - - -def build_patch_request( - vault_name: str, - resource_group_name: str, - subscription_id: str, - *, - json: Optional[_models.BackupResourceConfigResource] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + _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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -171,44 +146,40 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupResourceConfigResource] + 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, ) @@ -216,10 +187,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,52 +197,120 @@ 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 - @distributed_trace + @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. + :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. 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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.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] - _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, @@ -281,7 +319,8 @@ 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, ) @@ -289,10 +328,9 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,52 +338,120 @@ 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 - - @distributed_trace + @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. + :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. 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) + :return: None or the result of cls(response) :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :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: Union[_models.BackupResourceConfigResource, IO], + **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. Is either a model type or a IO type. Required. + :type parameters: + ~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) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, @@ -354,7 +460,8 @@ 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, ) @@ -362,10 +469,9 @@ def patch( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [204]: @@ -376,5 +482,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 06fa84f016a1..8aa54586cc39 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,13 +26,16 @@ 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, @@ -39,36 +48,34 @@ def build_list_request( _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") + 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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if skip_token is not None: - _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class BackupUsageSummariesCRROperations: """ @@ -89,7 +96,6 @@ def __init__(self, *args, **kwargs): 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, @@ -98,46 +104,50 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.BackupManagementUsageList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -145,17 +155,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -172,10 +182,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 @@ -186,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}/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 dc548f69b89d..34b9abd8c3ed 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,11 +6,16 @@ # 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, cast - -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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -21,54 +26,46 @@ 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') + +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: Optional[_models.CrossRegionRestoreRequest] = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: + +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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -89,34 +86,40 @@ def __init__(self, *args, **kwargs): 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: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -124,27 +127,28 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + 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, + *, + 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 @@ -153,11 +157,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 @@ -168,54 +175,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: + """ + + @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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # 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] + 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( # 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 = 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 + 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 9b65a016ecdd..4a1a95e11543 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +24,44 @@ 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: + +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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class CrrOperationResultsOperations: """ @@ -81,43 +82,41 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + 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, ) @@ -125,10 +124,9 @@ def get( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -139,5 +137,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 ace5d4969c83..297546bf0d90 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,9 +8,14 @@ # -------------------------------------------------------------------------- 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,48 +24,44 @@ 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: + +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") + 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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class CrrOperationStatusOperations: """ @@ -81,43 +82,39 @@ def __init__(self, *args, **kwargs): 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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', _params.pop('api-version', "2021-11-15")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationStatus] + 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, ) @@ -125,10 +122,9 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,12 +132,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/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py index 2242179a2f4a..f1c036bda44f 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,10 +7,16 @@ # 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 +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -20,20 +26,23 @@ 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 @@ -41,37 +50,35 @@ def build_list_request( _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") + 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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class RecoveryPointsCrrOperations: """ @@ -92,7 +99,6 @@ def __init__(self, *args, **kwargs): 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, @@ -103,52 +109,56 @@ 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: """ _headers = 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 - cls = kwargs.pop('cls', None) # type: ClsType[_models.RecoveryPointResourceList] + 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 + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + 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, ) @@ -156,19 +166,17 @@ def prepare_request(next_link=None): 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, - headers=_headers, - params=_params, + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore @@ -185,10 +193,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 @@ -199,8 +205,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 b497e43521a6..18acfbe9bebf 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,11 +6,16 @@ # 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, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -19,64 +24,60 @@ 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_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: Optional[_models.AADPropertiesResource] = None, - content: Any = None, + 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") + 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}/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 - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - content=content, - **kwargs - ) + _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: """ @@ -97,6 +98,89 @@ def __init__(self, *args, **kwargs): 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( @@ -107,59 +191,74 @@ 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: """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: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 400: lambda response: HttpResponseError(response=response, error_format=ARMErrorFormat), } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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', "2021-11-15")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.CrrAccessTokenResource] + 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, ) @@ -167,10 +266,9 @@ def get_access_token( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) + response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,12 +276,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