diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md b/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md index 0d87512a7f76..668274a2e16a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md +++ b/sdk/dataprotection/azure-mgmt-dataprotection/CHANGELOG.md @@ -1,5 +1,62 @@ # Release History +## 2.0.0 (2025-09-18) + +### Features Added + + - Model `DppBaseResource` added property `system_data` + - Model `ItemPathBasedRestoreCriteria` added property `rename_to` + - Model `KubernetesClusterBackupDatasourceParameters` added property `included_volume_types` + - Added enum `AKSVolumeTypes` + - Added enum `ActionType` + - Added model `AdlsBlobBackupDatasourceParameters` + - Added model `CloudError` + - Added model `Operation` + - Added model `OperationDisplay` + - Added enum `Origin` + - Added model `ProxyResource` + - Added model `Resource` + - Added model `TrackedResource` + - Added model `ValidateForModifyBackupRequest` + - Model `BackupInstancesOperations` added method `begin_validate_for_modify_backup` + +### Breaking Changes + + - Deleted or renamed client `DataProtectionMgmtClient` + - Deleted or renamed model `AzureBackupFindRestorableTimeRangesRequestResource` + - Deleted or renamed model `AzureBackupJobResourceList` + - Deleted or renamed model `AzureBackupRecoveryPointResourceList` + - Deleted or renamed model `BackupInstanceResourceList` + - Deleted or renamed model `BackupVaultResourceList` + - Deleted or renamed model `BaseBackupPolicyResourceList` + - Deleted or renamed model `ClientDiscoveryDisplay` + - Deleted or renamed model `ClientDiscoveryForLogSpecification` + - Deleted or renamed model `ClientDiscoveryForProperties` + - Deleted or renamed model `ClientDiscoveryForServiceSpecification` + - Deleted or renamed model `ClientDiscoveryResponse` + - Deleted or renamed model `ClientDiscoveryValueForSingleApi` + - Deleted or renamed model `DeletedBackupInstanceResourceList` + - Deleted or renamed model `DppBaseResourceList` + - Deleted or renamed model `DppBaseTrackedResource` + - Deleted or renamed model `DppProxyResource` + - Deleted or renamed model `DppTrackedResource` + - Deleted or renamed model `DppWorkerRequest` + - Deleted or renamed model `RecoveryPointsFilters` + - Deleted or renamed model `ResourceGuardProxyBaseResourceList` + - Deleted or renamed model `ResourceGuardResourceList` + - Method `BackupInstancesOperations.begin_create_or_update` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `BackupInstancesOperations.begin_delete` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `BackupInstancesOperations.begin_stop_protection` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `BackupInstancesOperations.begin_suspend_backups` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `BackupInstancesOperations.begin_trigger_restore` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `BackupVaultsOperations.begin_create_or_update` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `BackupVaultsOperations.begin_update` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `DppResourceGuardProxyOperations.unlock_delete` changed its parameter `x_ms_authorization_auxiliary` from `positional_or_keyword` to `keyword_only` + - Method `FetchSecondaryRecoveryPointsOperations.list` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `RecoveryPointsOperations.list` changed its parameter `skip_token` from `positional_or_keyword` to `keyword_only` + - Method `BackupInstancesOperations.begin_stop_protection` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'backup_instance_name', 'x_ms_authorization_auxiliary', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'backup_instance_name', 'parameters', 'x_ms_authorization_auxiliary', 'kwargs']` + - Method `BackupInstancesOperations.begin_suspend_backups` re-ordered its parameters from `['self', 'resource_group_name', 'vault_name', 'backup_instance_name', 'x_ms_authorization_auxiliary', 'parameters', 'kwargs']` to `['self', 'resource_group_name', 'vault_name', 'backup_instance_name', 'parameters', 'x_ms_authorization_auxiliary', 'kwargs']` + ## 1.4.0 (2024-07-22) ### Features Added diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in b/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in index 96b3907f47cf..84de5979b1a4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in +++ b/sdk/dataprotection/azure-mgmt-dataprotection/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/dataprotection/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/README.md b/sdk/dataprotection/azure-mgmt-dataprotection/README.md index c874cebbaa51..27eab34c29b1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/README.md +++ b/sdk/dataprotection/azure-mgmt-dataprotection/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Data Protection Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json deleted file mode 100644 index 44df65fcbeb8..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "7bf13ef1c776f6d973b9645906281d0ec4660fc8", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.13.19", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/dataprotection/resource-manager/readme.md" -} \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_metadata.json b/sdk/dataprotection/azure-mgmt-dataprotection/_metadata.json new file mode 100644 index 000000000000..22588b41e39f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_metadata.json @@ -0,0 +1,7 @@ +{ + "apiVersion": "2025-07-01", + "commit": "12850330a0b9e339ded4e707c8312d74a57c2d9f", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/dataprotection/resource-manager/Microsoft.DataProtection/DataProtection", + "emitterVersion": "0.50.0" +} \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/apiview-properties.json b/sdk/dataprotection/azure-mgmt-dataprotection/apiview-properties.json new file mode 100644 index 000000000000..b1cdba2af84d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/apiview-properties.json @@ -0,0 +1,343 @@ +{ + "CrossLanguagePackageId": "Microsoft.DataProtection", + "CrossLanguageDefinitionId": { + "azure.mgmt.dataprotection.models.DeleteOption": "Microsoft.DataProtection.DeleteOption", + "azure.mgmt.dataprotection.models.AbsoluteDeleteOption": "Microsoft.DataProtection.AbsoluteDeleteOption", + "azure.mgmt.dataprotection.models.AdHocBackupRuleOptions": "Microsoft.DataProtection.AdHocBackupRuleOptions", + "azure.mgmt.dataprotection.models.AdhocBackupTriggerOption": "Microsoft.DataProtection.AdhocBackupTriggerOption", + "azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria": "Microsoft.DataProtection.AdhocBasedTaggingCriteria", + "azure.mgmt.dataprotection.models.TriggerContext": "Microsoft.DataProtection.TriggerContext", + "azure.mgmt.dataprotection.models.AdhocBasedTriggerContext": "Microsoft.DataProtection.AdhocBasedTriggerContext", + "azure.mgmt.dataprotection.models.BackupDatasourceParameters": "Microsoft.DataProtection.BackupDatasourceParameters", + "azure.mgmt.dataprotection.models.BlobBackupDatasourceParameters": "Microsoft.DataProtection.BlobBackupDatasourceParameters", + "azure.mgmt.dataprotection.models.AdlsBlobBackupDatasourceParameters": "Microsoft.DataProtection.AdlsBlobBackupDatasourceParameters", + "azure.mgmt.dataprotection.models.AuthCredentials": "Microsoft.DataProtection.AuthCredentials", + "azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint": "Microsoft.DataProtection.AzureBackupRecoveryPoint", + "azure.mgmt.dataprotection.models.AzureBackupDiscreteRecoveryPoint": "Microsoft.DataProtection.AzureBackupDiscreteRecoveryPoint", + "azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest": "Microsoft.DataProtection.AzureBackupFindRestorableTimeRangesRequest", + "azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse": "Microsoft.DataProtection.AzureBackupFindRestorableTimeRangesResponse", + "azure.mgmt.dataprotection.models.DppResource": "Microsoft.DataProtection.DppResource", + "azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource": "Microsoft.DataProtection.AzureBackupFindRestorableTimeRangesResponseResource", + "azure.mgmt.dataprotection.models.AzureBackupJob": "Microsoft.DataProtection.AzureBackupJob", + "azure.mgmt.dataprotection.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.dataprotection.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.dataprotection.models.AzureBackupJobResource": "Microsoft.DataProtection.AzureBackupJobResource", + "azure.mgmt.dataprotection.models.BackupParameters": "Microsoft.DataProtection.BackupParameters", + "azure.mgmt.dataprotection.models.AzureBackupParams": "Microsoft.DataProtection.AzureBackupParams", + "azure.mgmt.dataprotection.models.AzureBackupRestoreRequest": "Microsoft.DataProtection.AzureBackupRestoreRequest", + "azure.mgmt.dataprotection.models.AzureBackupRecoveryPointBasedRestoreRequest": "Microsoft.DataProtection.AzureBackupRecoveryPointBasedRestoreRequest", + "azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource": "Microsoft.DataProtection.AzureBackupRecoveryPointResource", + "azure.mgmt.dataprotection.models.AzureBackupRecoveryTimeBasedRestoreRequest": "Microsoft.DataProtection.AzureBackupRecoveryTimeBasedRestoreRequest", + "azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest": "Microsoft.DataProtection.AzureBackupRehydrationRequest", + "azure.mgmt.dataprotection.models.AzureBackupRestoreWithRehydrationRequest": "Microsoft.DataProtection.AzureBackupRestoreWithRehydrationRequest", + "azure.mgmt.dataprotection.models.BasePolicyRule": "Microsoft.DataProtection.BasePolicyRule", + "azure.mgmt.dataprotection.models.AzureBackupRule": "Microsoft.DataProtection.AzureBackupRule", + "azure.mgmt.dataprotection.models.AzureMonitorAlertSettings": "Microsoft.DataProtection.AzureMonitorAlertSettings", + "azure.mgmt.dataprotection.models.DataStoreParameters": "Microsoft.DataProtection.DataStoreParameters", + "azure.mgmt.dataprotection.models.AzureOperationalStoreParameters": "Microsoft.DataProtection.AzureOperationalStoreParameters", + "azure.mgmt.dataprotection.models.AzureRetentionRule": "Microsoft.DataProtection.AzureRetentionRule", + "azure.mgmt.dataprotection.models.BackupCriteria": "Microsoft.DataProtection.BackupCriteria", + "azure.mgmt.dataprotection.models.BackupInstance": "Microsoft.DataProtection.BackupInstance", + "azure.mgmt.dataprotection.models.BackupInstanceResource": "Microsoft.DataProtection.BackupInstanceResource", + "azure.mgmt.dataprotection.models.BaseBackupPolicy": "Microsoft.DataProtection.BaseBackupPolicy", + "azure.mgmt.dataprotection.models.BackupPolicy": "Microsoft.DataProtection.BackupPolicy", + "azure.mgmt.dataprotection.models.BackupSchedule": "Microsoft.DataProtection.BackupSchedule", + "azure.mgmt.dataprotection.models.BackupVault": "Microsoft.DataProtection.BackupVault", + "azure.mgmt.dataprotection.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.dataprotection.models.BackupVaultResource": "Microsoft.DataProtection.BackupVaultResource", + "azure.mgmt.dataprotection.models.BaseBackupPolicyResource": "Microsoft.DataProtection.BaseBackupPolicyResource", + "azure.mgmt.dataprotection.models.BaseResourceProperties": "Microsoft.DataProtection.BaseResourceProperties", + "azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest": "Microsoft.DataProtection.CheckNameAvailabilityRequest", + "azure.mgmt.dataprotection.models.CheckNameAvailabilityResult": "Microsoft.DataProtection.CheckNameAvailabilityResult", + "azure.mgmt.dataprotection.models.CloudError": "Microsoft.DataProtection.CloudError", + "azure.mgmt.dataprotection.models.CmkKekIdentity": "Microsoft.DataProtection.CmkKekIdentity", + "azure.mgmt.dataprotection.models.CmkKeyVaultProperties": "Microsoft.DataProtection.CmkKeyVaultProperties", + "azure.mgmt.dataprotection.models.CopyOption": "Microsoft.DataProtection.CopyOption", + "azure.mgmt.dataprotection.models.CopyOnExpiryOption": "Microsoft.DataProtection.CopyOnExpiryOption", + "azure.mgmt.dataprotection.models.CrossRegionRestoreDetails": "Microsoft.DataProtection.CrossRegionRestoreDetails", + "azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest": "Microsoft.DataProtection.CrossRegionRestoreJobRequest", + "azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest": "Microsoft.DataProtection.CrossRegionRestoreJobsRequest", + "azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject": "Microsoft.DataProtection.CrossRegionRestoreRequestObject", + "azure.mgmt.dataprotection.models.CrossRegionRestoreSettings": "Microsoft.DataProtection.CrossRegionRestoreSettings", + "azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings": "Microsoft.DataProtection.CrossSubscriptionRestoreSettings", + "azure.mgmt.dataprotection.models.CustomCopyOption": "Microsoft.DataProtection.CustomCopyOption", + "azure.mgmt.dataprotection.models.Datasource": "Microsoft.DataProtection.Datasource", + "azure.mgmt.dataprotection.models.DatasourceSet": "Microsoft.DataProtection.DatasourceSet", + "azure.mgmt.dataprotection.models.DataStoreInfoBase": "Microsoft.DataProtection.DataStoreInfoBase", + "azure.mgmt.dataprotection.models.Day": "Microsoft.DataProtection.Day", + "azure.mgmt.dataprotection.models.DefaultResourceProperties": "Microsoft.DataProtection.DefaultResourceProperties", + "azure.mgmt.dataprotection.models.DeletedBackupInstance": "Microsoft.DataProtection.DeletedBackupInstance", + "azure.mgmt.dataprotection.models.DeletedBackupInstanceResource": "Microsoft.DataProtection.DeletedBackupInstanceResource", + "azure.mgmt.dataprotection.models.DeletionInfo": "Microsoft.DataProtection.DeletionInfo", + "azure.mgmt.dataprotection.models.DppBaseResource": "Microsoft.DataProtection.DppBaseResource", + "azure.mgmt.dataprotection.models.DppIdentityDetails": "Microsoft.DataProtection.DppIdentityDetails", + "azure.mgmt.dataprotection.models.DppResourceList": "Microsoft.DataProtection.DppResourceList", + "azure.mgmt.dataprotection.models.DppTrackedResourceList": "Microsoft.DataProtection.DppTrackedResourceList", + "azure.mgmt.dataprotection.models.EncryptionSettings": "Microsoft.DataProtection.EncryptionSettings", + "azure.mgmt.dataprotection.models.Error": "Microsoft.DataProtection.Error", + "azure.mgmt.dataprotection.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.dataprotection.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.dataprotection.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.dataprotection.models.ExportJobsResult": "Microsoft.DataProtection.ExportJobsResult", + "azure.mgmt.dataprotection.models.FeatureSettings": "Microsoft.DataProtection.FeatureSettings", + "azure.mgmt.dataprotection.models.FeatureValidationRequestBase": "Microsoft.DataProtection.FeatureValidationRequestBase", + "azure.mgmt.dataprotection.models.FeatureValidationRequest": "Microsoft.DataProtection.FeatureValidationRequest", + "azure.mgmt.dataprotection.models.FeatureValidationResponseBase": "Microsoft.DataProtection.FeatureValidationResponseBase", + "azure.mgmt.dataprotection.models.FeatureValidationResponse": "Microsoft.DataProtection.FeatureValidationResponse", + "azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters": "Microsoft.DataProtection.FetchSecondaryRPsRequestParameters", + "azure.mgmt.dataprotection.models.IdentityDetails": "Microsoft.DataProtection.IdentityDetails", + "azure.mgmt.dataprotection.models.ImmediateCopyOption": "Microsoft.DataProtection.ImmediateCopyOption", + "azure.mgmt.dataprotection.models.ImmutabilitySettings": "Microsoft.DataProtection.ImmutabilitySettings", + "azure.mgmt.dataprotection.models.InnerError": "Microsoft.DataProtection.InnerError", + "azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria": "Microsoft.DataProtection.ItemLevelRestoreCriteria", + "azure.mgmt.dataprotection.models.RestoreTargetInfoBase": "Microsoft.DataProtection.RestoreTargetInfoBase", + "azure.mgmt.dataprotection.models.ItemLevelRestoreTargetInfo": "Microsoft.DataProtection.ItemLevelRestoreTargetInfo", + "azure.mgmt.dataprotection.models.ItemPathBasedRestoreCriteria": "Microsoft.DataProtection.ItemPathBasedRestoreCriteria", + "azure.mgmt.dataprotection.models.JobExtendedInfo": "Microsoft.DataProtection.JobExtendedInfo", + "azure.mgmt.dataprotection.models.JobSubTask": "Microsoft.DataProtection.JobSubTask", + "azure.mgmt.dataprotection.models.KubernetesClusterBackupDatasourceParameters": "Microsoft.DataProtection.KubernetesClusterBackupDatasourceParameters", + "azure.mgmt.dataprotection.models.KubernetesClusterRestoreCriteria": "Microsoft.DataProtection.KubernetesClusterRestoreCriteria", + "azure.mgmt.dataprotection.models.KubernetesClusterVaultTierRestoreCriteria": "Microsoft.DataProtection.KubernetesClusterVaultTierRestoreCriteria", + "azure.mgmt.dataprotection.models.KubernetesPVRestoreCriteria": "Microsoft.DataProtection.KubernetesPVRestoreCriteria", + "azure.mgmt.dataprotection.models.KubernetesStorageClassRestoreCriteria": "Microsoft.DataProtection.KubernetesStorageClassRestoreCriteria", + "azure.mgmt.dataprotection.models.MonitoringSettings": "Microsoft.DataProtection.MonitoringSettings", + "azure.mgmt.dataprotection.models.NamespacedNameResource": "Microsoft.DataProtection.NamespacedNameResource", + "azure.mgmt.dataprotection.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.dataprotection.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.dataprotection.models.OperationExtendedInfo": "Microsoft.DataProtection.OperationExtendedInfo", + "azure.mgmt.dataprotection.models.OperationJobExtendedInfo": "Microsoft.DataProtection.OperationJobExtendedInfo", + "azure.mgmt.dataprotection.models.OperationResource": "Microsoft.DataProtection.OperationResource", + "azure.mgmt.dataprotection.models.PatchBackupVaultInput": "Microsoft.DataProtection.PatchBackupVaultInput", + "azure.mgmt.dataprotection.models.PatchResourceGuardInput": "Microsoft.DataProtection.PatchResourceGuardInput", + "azure.mgmt.dataprotection.models.PatchResourceRequestInput": "Microsoft.DataProtection.PatchResourceRequestInput", + "azure.mgmt.dataprotection.models.PolicyInfo": "Microsoft.DataProtection.PolicyInfo", + "azure.mgmt.dataprotection.models.PolicyParameters": "Microsoft.DataProtection.PolicyParameters", + "azure.mgmt.dataprotection.models.ProtectionStatusDetails": "Microsoft.DataProtection.ProtectionStatusDetails", + "azure.mgmt.dataprotection.models.RangeBasedItemLevelRestoreCriteria": "Microsoft.DataProtection.RangeBasedItemLevelRestoreCriteria", + "azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails": "Microsoft.DataProtection.RecoveryPointDataStoreDetails", + "azure.mgmt.dataprotection.models.ResourceGuard": "Microsoft.DataProtection.ResourceGuard", + "azure.mgmt.dataprotection.models.ResourceGuardOperation": "Microsoft.DataProtection.ResourceGuardOperation", + "azure.mgmt.dataprotection.models.ResourceGuardOperationDetail": "Microsoft.DataProtection.ResourceGuardOperationDetail", + "azure.mgmt.dataprotection.models.ResourceGuardProxyBase": "Microsoft.DataProtection.ResourceGuardProxyBase", + "azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource": "Microsoft.DataProtection.ResourceGuardProxyBaseResource", + "azure.mgmt.dataprotection.models.ResourceGuardResource": "Microsoft.DataProtection.ResourceGuardResource", + "azure.mgmt.dataprotection.models.ResourceMoveDetails": "Microsoft.DataProtection.ResourceMoveDetails", + "azure.mgmt.dataprotection.models.RestorableTimeRange": "Microsoft.DataProtection.RestorableTimeRange", + "azure.mgmt.dataprotection.models.RestoreFilesTargetInfo": "Microsoft.DataProtection.RestoreFilesTargetInfo", + "azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails": "Microsoft.DataProtection.RestoreJobRecoveryPointDetails", + "azure.mgmt.dataprotection.models.RestoreTargetInfo": "Microsoft.DataProtection.RestoreTargetInfo", + "azure.mgmt.dataprotection.models.RetentionTag": "Microsoft.DataProtection.RetentionTag", + "azure.mgmt.dataprotection.models.ScheduleBasedBackupCriteria": "Microsoft.DataProtection.ScheduleBasedBackupCriteria", + "azure.mgmt.dataprotection.models.ScheduleBasedTriggerContext": "Microsoft.DataProtection.ScheduleBasedTriggerContext", + "azure.mgmt.dataprotection.models.SecretStoreBasedAuthCredentials": "Microsoft.DataProtection.SecretStoreBasedAuthCredentials", + "azure.mgmt.dataprotection.models.SecretStoreResource": "Microsoft.DataProtection.SecretStoreResource", + "azure.mgmt.dataprotection.models.SecuritySettings": "Microsoft.DataProtection.SecuritySettings", + "azure.mgmt.dataprotection.models.SoftDeleteSettings": "Microsoft.DataProtection.SoftDeleteSettings", + "azure.mgmt.dataprotection.models.SourceLifeCycle": "Microsoft.DataProtection.SourceLifeCycle", + "azure.mgmt.dataprotection.models.StopProtectionRequest": "Microsoft.DataProtection.StopProtectionRequest", + "azure.mgmt.dataprotection.models.StorageSetting": "Microsoft.DataProtection.StorageSetting", + "azure.mgmt.dataprotection.models.SupportedFeature": "Microsoft.DataProtection.SupportedFeature", + "azure.mgmt.dataprotection.models.SuspendBackupRequest": "Microsoft.DataProtection.SuspendBackupRequest", + "azure.mgmt.dataprotection.models.SyncBackupInstanceRequest": "Microsoft.DataProtection.SyncBackupInstanceRequest", + "azure.mgmt.dataprotection.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.dataprotection.models.TaggingCriteria": "Microsoft.DataProtection.TaggingCriteria", + "azure.mgmt.dataprotection.models.TargetCopySetting": "Microsoft.DataProtection.TargetCopySetting", + "azure.mgmt.dataprotection.models.TargetDetails": "Microsoft.DataProtection.TargetDetails", + "azure.mgmt.dataprotection.models.TriggerBackupRequest": "Microsoft.DataProtection.TriggerBackupRequest", + "azure.mgmt.dataprotection.models.UnlockDeleteRequest": "Microsoft.DataProtection.UnlockDeleteRequest", + "azure.mgmt.dataprotection.models.UnlockDeleteResponse": "Microsoft.DataProtection.UnlockDeleteResponse", + "azure.mgmt.dataprotection.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.dataprotection.models.UserFacingError": "Microsoft.DataProtection.UserFacingError", + "azure.mgmt.dataprotection.models.UserFacingWarningDetail": "Microsoft.DataProtection.UserFacingWarningDetail", + "azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject": "Microsoft.DataProtection.ValidateCrossRegionRestoreRequestObject", + "azure.mgmt.dataprotection.models.ValidateForBackupRequest": "Microsoft.DataProtection.ValidateForBackupRequest", + "azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest": "Microsoft.DataProtection.ValidateForModifyBackupRequest", + "azure.mgmt.dataprotection.models.ValidateRestoreRequestObject": "Microsoft.DataProtection.ValidateRestoreRequestObject", + "azure.mgmt.dataprotection.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.dataprotection.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.dataprotection.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.dataprotection.models.ResourcePropertiesObjectType": "Microsoft.DataProtection.ResourcePropertiesObjectType", + "azure.mgmt.dataprotection.models.DataStoreTypes": "Microsoft.DataProtection.DataStoreTypes", + "azure.mgmt.dataprotection.models.AKSVolumeTypes": "Microsoft.DataProtection.AKSVolumeTypes", + "azure.mgmt.dataprotection.models.Status": "Microsoft.DataProtection.Status", + "azure.mgmt.dataprotection.models.CurrentProtectionState": "Microsoft.DataProtection.CurrentProtectionState", + "azure.mgmt.dataprotection.models.SecretStoreType": "Microsoft.DataProtection.SecretStoreType", + "azure.mgmt.dataprotection.models.ValidationType": "Microsoft.DataProtection.ValidationType", + "azure.mgmt.dataprotection.models.RehydrationPriority": "Microsoft.DataProtection.RehydrationPriority", + "azure.mgmt.dataprotection.models.RecoveryOption": "Microsoft.DataProtection.RecoveryOption", + "azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode": "Microsoft.DataProtection.PersistentVolumeRestoreMode", + "azure.mgmt.dataprotection.models.ExistingResourcePolicy": "Microsoft.DataProtection.ExistingResourcePolicy", + "azure.mgmt.dataprotection.models.RestoreTargetLocationType": "Microsoft.DataProtection.RestoreTargetLocationType", + "azure.mgmt.dataprotection.models.SourceDataStoreType": "Microsoft.DataProtection.SourceDataStoreType", + "azure.mgmt.dataprotection.models.SyncType": "Microsoft.DataProtection.SyncType", + "azure.mgmt.dataprotection.models.AlertsState": "Microsoft.DataProtection.AlertsState", + "azure.mgmt.dataprotection.models.ProvisioningState": "Microsoft.DataProtection.ProvisioningState", + "azure.mgmt.dataprotection.models.ResourceMoveState": "Microsoft.DataProtection.ResourceMoveState", + "azure.mgmt.dataprotection.models.SoftDeleteState": "Microsoft.DataProtection.SoftDeleteState", + "azure.mgmt.dataprotection.models.ImmutabilityState": "Microsoft.DataProtection.ImmutabilityState", + "azure.mgmt.dataprotection.models.EncryptionState": "Microsoft.DataProtection.EncryptionState", + "azure.mgmt.dataprotection.models.IdentityType": "Microsoft.DataProtection.IdentityType", + "azure.mgmt.dataprotection.models.InfrastructureEncryptionState": "Microsoft.DataProtection.InfrastructureEncryptionState", + "azure.mgmt.dataprotection.models.StorageSettingStoreTypes": "Microsoft.DataProtection.StorageSettingStoreTypes", + "azure.mgmt.dataprotection.models.StorageSettingTypes": "Microsoft.DataProtection.StorageSettingTypes", + "azure.mgmt.dataprotection.models.CrossSubscriptionRestoreState": "Microsoft.DataProtection.CrossSubscriptionRestoreState", + "azure.mgmt.dataprotection.models.CrossRegionRestoreState": "Microsoft.DataProtection.CrossRegionRestoreState", + "azure.mgmt.dataprotection.models.SecureScoreLevel": "Microsoft.DataProtection.SecureScoreLevel", + "azure.mgmt.dataprotection.models.BCDRSecurityLevel": "Microsoft.DataProtection.BCDRSecurityLevel", + "azure.mgmt.dataprotection.models.AbsoluteMarker": "Microsoft.DataProtection.AbsoluteMarker", + "azure.mgmt.dataprotection.models.DayOfWeek": "Microsoft.DataProtection.DayOfWeek", + "azure.mgmt.dataprotection.models.Month": "Microsoft.DataProtection.Month", + "azure.mgmt.dataprotection.models.WeekNumber": "Microsoft.DataProtection.WeekNumber", + "azure.mgmt.dataprotection.models.RestoreSourceDataStoreType": "Microsoft.DataProtection.RestoreSourceDataStoreType", + "azure.mgmt.dataprotection.models.RehydrationStatus": "Microsoft.DataProtection.RehydrationStatus", + "azure.mgmt.dataprotection.models.RecoveryPointCompletionState": "Microsoft.DataProtection.RecoveryPointCompletionState", + "azure.mgmt.dataprotection.models.FeatureType": "Microsoft.DataProtection.FeatureType", + "azure.mgmt.dataprotection.models.FeatureSupportStatus": "Microsoft.DataProtection.FeatureSupportStatus", + "azure.mgmt.dataprotection.operations.DataProtectionOperationsOperations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.dataprotection.aio.operations.DataProtectionOperationsOperations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.get_backup_instance_operation_result": "Microsoft.DataProtection.BackupInstances.getBackupInstanceOperationResult", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.get_backup_instance_operation_result": "Microsoft.DataProtection.BackupInstances.getBackupInstanceOperationResult", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.list": "Microsoft.DataProtection.BackupInstances.list", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.list": "Microsoft.DataProtection.BackupInstances.list", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_validate_for_backup": "Microsoft.DataProtection.BackupVaultResources.validateForBackup", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_validate_for_backup": "Microsoft.DataProtection.BackupVaultResources.validateForBackup", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.get": "Microsoft.DataProtection.BackupInstanceResources.get", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.get": "Microsoft.DataProtection.BackupInstanceResources.get", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_create_or_update": "Microsoft.DataProtection.BackupInstanceResources.createOrUpdate", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_create_or_update": "Microsoft.DataProtection.BackupInstanceResources.createOrUpdate", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_delete": "Microsoft.DataProtection.BackupInstanceResources.delete", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_delete": "Microsoft.DataProtection.BackupInstanceResources.delete", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_adhoc_backup": "Microsoft.DataProtection.BackupInstanceResources.adhocBackup", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_adhoc_backup": "Microsoft.DataProtection.BackupInstanceResources.adhocBackup", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_validate_for_modify_backup": "Microsoft.DataProtection.BackupInstanceResources.validateForModifyBackup", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_validate_for_modify_backup": "Microsoft.DataProtection.BackupInstanceResources.validateForModifyBackup", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_trigger_rehydrate": "Microsoft.DataProtection.BackupInstanceResources.triggerRehydrate", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_trigger_rehydrate": "Microsoft.DataProtection.BackupInstanceResources.triggerRehydrate", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_trigger_restore": "Microsoft.DataProtection.BackupInstanceResources.triggerRestore", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_trigger_restore": "Microsoft.DataProtection.BackupInstanceResources.triggerRestore", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_resume_backups": "Microsoft.DataProtection.BackupInstanceResources.resumeBackups", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_resume_backups": "Microsoft.DataProtection.BackupInstanceResources.resumeBackups", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_resume_protection": "Microsoft.DataProtection.BackupInstanceResources.resumeProtection", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_resume_protection": "Microsoft.DataProtection.BackupInstanceResources.resumeProtection", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_stop_protection": "Microsoft.DataProtection.BackupInstanceResources.stopProtection", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_stop_protection": "Microsoft.DataProtection.BackupInstanceResources.stopProtection", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_suspend_backups": "Microsoft.DataProtection.BackupInstanceResources.suspendBackups", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_suspend_backups": "Microsoft.DataProtection.BackupInstanceResources.suspendBackups", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_sync_backup_instance": "Microsoft.DataProtection.BackupInstanceResources.syncBackupInstance", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_sync_backup_instance": "Microsoft.DataProtection.BackupInstanceResources.syncBackupInstance", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_validate_for_restore": "Microsoft.DataProtection.BackupInstanceResources.validateForRestore", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_validate_for_restore": "Microsoft.DataProtection.BackupInstanceResources.validateForRestore", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_trigger_cross_region_restore": "Microsoft.DataProtection.BackupInstancesOperationGroup.triggerCrossRegionRestore", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_trigger_cross_region_restore": "Microsoft.DataProtection.BackupInstancesOperationGroup.triggerCrossRegionRestore", + "azure.mgmt.dataprotection.operations.BackupInstancesOperations.begin_validate_cross_region_restore": "Microsoft.DataProtection.BackupInstancesOperationGroup.validateCrossRegionRestore", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations.begin_validate_cross_region_restore": "Microsoft.DataProtection.BackupInstancesOperationGroup.validateCrossRegionRestore", + "azure.mgmt.dataprotection.operations.BackupVaultOperationResultsOperations.get": "Microsoft.DataProtection.BackupVaultOperationResults.get", + "azure.mgmt.dataprotection.aio.operations.BackupVaultOperationResultsOperations.get": "Microsoft.DataProtection.BackupVaultOperationResults.get", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_default_delete_resource_guard_proxy_requests_object": "Microsoft.DataProtection.ResourceGuards.getDefaultDeleteResourceGuardProxyRequestsObject", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_default_delete_resource_guard_proxy_requests_object": "Microsoft.DataProtection.ResourceGuards.getDefaultDeleteResourceGuardProxyRequestsObject", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_delete_resource_guard_proxy_requests_objects": "Microsoft.DataProtection.ResourceGuards.getDeleteResourceGuardProxyRequestsObjects", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_delete_resource_guard_proxy_requests_objects": "Microsoft.DataProtection.ResourceGuards.getDeleteResourceGuardProxyRequestsObjects", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get": "Microsoft.DataProtection.ResourceGuardResources.get", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get": "Microsoft.DataProtection.ResourceGuardResources.get", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.put": "Microsoft.DataProtection.ResourceGuardResources.put", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.put": "Microsoft.DataProtection.ResourceGuardResources.put", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.patch": "Microsoft.DataProtection.ResourceGuardResources.patch", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.patch": "Microsoft.DataProtection.ResourceGuardResources.patch", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.delete": "Microsoft.DataProtection.ResourceGuardResources.delete", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.delete": "Microsoft.DataProtection.ResourceGuardResources.delete", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_resources_in_resource_group": "Microsoft.DataProtection.ResourceGuardResources.getResourcesInResourceGroup", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_resources_in_resource_group": "Microsoft.DataProtection.ResourceGuardResources.getResourcesInResourceGroup", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_resources_in_subscription": "Microsoft.DataProtection.ResourceGuardResources.getResourcesInSubscription", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_resources_in_subscription": "Microsoft.DataProtection.ResourceGuardResources.getResourcesInSubscription", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_default_disable_soft_delete_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultDisableSoftDeleteRequestsObject", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_default_disable_soft_delete_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultDisableSoftDeleteRequestsObject", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_disable_soft_delete_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDisableSoftDeleteRequestsObjects", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_disable_soft_delete_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDisableSoftDeleteRequestsObjects", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_default_update_protected_item_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultUpdateProtectedItemRequestsObject", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_default_update_protected_item_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultUpdateProtectedItemRequestsObject", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_update_protected_item_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getUpdateProtectedItemRequestsObjects", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_update_protected_item_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getUpdateProtectedItemRequestsObjects", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_default_update_protection_policy_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultUpdateProtectionPolicyRequestsObject", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_default_update_protection_policy_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultUpdateProtectionPolicyRequestsObject", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_update_protection_policy_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getUpdateProtectionPolicyRequestsObjects", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_update_protection_policy_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getUpdateProtectionPolicyRequestsObjects", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_default_delete_protected_item_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultDeleteProtectedItemRequestsObject", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_default_delete_protected_item_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultDeleteProtectedItemRequestsObject", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_delete_protected_item_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDeleteProtectedItemRequestsObjects", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_delete_protected_item_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDeleteProtectedItemRequestsObjects", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_default_backup_security_pin_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultBackupSecurityPINRequestsObject", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_default_backup_security_pin_requests_object": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getDefaultBackupSecurityPINRequestsObject", + "azure.mgmt.dataprotection.operations.ResourceGuardsOperations.get_backup_security_pin_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getBackupSecurityPINRequestsObjects", + "azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations.get_backup_security_pin_requests_objects": "Microsoft.DataProtection.DppBaseResourceOperationGroup.getBackupSecurityPINRequestsObjects", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.get": "Microsoft.DataProtection.BackupVaultResources.get", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.get": "Microsoft.DataProtection.BackupVaultResources.get", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.begin_create_or_update": "Microsoft.DataProtection.BackupVaultResources.createOrUpdate", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.begin_create_or_update": "Microsoft.DataProtection.BackupVaultResources.createOrUpdate", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.begin_update": "Microsoft.DataProtection.BackupVaultResources.update", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.begin_update": "Microsoft.DataProtection.BackupVaultResources.update", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.begin_delete": "Microsoft.DataProtection.BackupVaultResources.delete", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.begin_delete": "Microsoft.DataProtection.BackupVaultResources.delete", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.get_in_subscription": "Microsoft.DataProtection.BackupVaultResources.getInSubscription", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.get_in_subscription": "Microsoft.DataProtection.BackupVaultResources.getInSubscription", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.get_in_resource_group": "Microsoft.DataProtection.BackupVaultOperationResults.getInResourceGroup", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.get_in_resource_group": "Microsoft.DataProtection.BackupVaultOperationResults.getInResourceGroup", + "azure.mgmt.dataprotection.operations.BackupVaultsOperations.check_name_availability": "Microsoft.DataProtection.BackupVaultsOperationGroup.checkNameAvailability", + "azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations.check_name_availability": "Microsoft.DataProtection.BackupVaultsOperationGroup.checkNameAvailability", + "azure.mgmt.dataprotection.operations.OperationStatusBackupVaultContextOperations.get": "Microsoft.DataProtection.BackupVaultResources.operationStatusBackupVaultContextGet", + "azure.mgmt.dataprotection.aio.operations.OperationStatusBackupVaultContextOperations.get": "Microsoft.DataProtection.BackupVaultResources.operationStatusBackupVaultContextGet", + "azure.mgmt.dataprotection.operations.ExportJobsOperations.begin_trigger": "Microsoft.DataProtection.BackupVaultResources.trigger", + "azure.mgmt.dataprotection.aio.operations.ExportJobsOperations.begin_trigger": "Microsoft.DataProtection.BackupVaultResources.trigger", + "azure.mgmt.dataprotection.operations.ExportJobsOperationResultOperations.get": "Microsoft.DataProtection.BackupVaultResources.exportJobsOperationResultGet", + "azure.mgmt.dataprotection.aio.operations.ExportJobsOperationResultOperations.get": "Microsoft.DataProtection.BackupVaultResources.exportJobsOperationResultGet", + "azure.mgmt.dataprotection.operations.BackupPoliciesOperations.get": "Microsoft.DataProtection.BaseBackupPolicyResources.get", + "azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations.get": "Microsoft.DataProtection.BaseBackupPolicyResources.get", + "azure.mgmt.dataprotection.operations.BackupPoliciesOperations.create_or_update": "Microsoft.DataProtection.BaseBackupPolicyResources.createOrUpdate", + "azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations.create_or_update": "Microsoft.DataProtection.BaseBackupPolicyResources.createOrUpdate", + "azure.mgmt.dataprotection.operations.BackupPoliciesOperations.delete": "Microsoft.DataProtection.BaseBackupPolicyResources.delete", + "azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations.delete": "Microsoft.DataProtection.BaseBackupPolicyResources.delete", + "azure.mgmt.dataprotection.operations.BackupPoliciesOperations.list": "Microsoft.DataProtection.BaseBackupPolicyResources.list", + "azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations.list": "Microsoft.DataProtection.BaseBackupPolicyResources.list", + "azure.mgmt.dataprotection.operations.RestorableTimeRangesOperations.find": "Microsoft.DataProtection.BackupInstanceResources.find", + "azure.mgmt.dataprotection.aio.operations.RestorableTimeRangesOperations.find": "Microsoft.DataProtection.BackupInstanceResources.find", + "azure.mgmt.dataprotection.operations.RecoveryPointsOperations.get": "Microsoft.DataProtection.AzureBackupRecoveryPointResources.get", + "azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations.get": "Microsoft.DataProtection.AzureBackupRecoveryPointResources.get", + "azure.mgmt.dataprotection.operations.RecoveryPointsOperations.list": "Microsoft.DataProtection.AzureBackupRecoveryPointResources.list", + "azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations.list": "Microsoft.DataProtection.AzureBackupRecoveryPointResources.list", + "azure.mgmt.dataprotection.operations.JobsOperations.get": "Microsoft.DataProtection.AzureBackupJobResources.get", + "azure.mgmt.dataprotection.aio.operations.JobsOperations.get": "Microsoft.DataProtection.AzureBackupJobResources.get", + "azure.mgmt.dataprotection.operations.JobsOperations.list": "Microsoft.DataProtection.AzureBackupJobResources.list", + "azure.mgmt.dataprotection.aio.operations.JobsOperations.list": "Microsoft.DataProtection.AzureBackupJobResources.list", + "azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations.get": "Microsoft.DataProtection.DeletedBackupInstanceResources.get", + "azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations.get": "Microsoft.DataProtection.DeletedBackupInstanceResources.get", + "azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations.list": "Microsoft.DataProtection.DeletedBackupInstanceResources.list", + "azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations.list": "Microsoft.DataProtection.DeletedBackupInstanceResources.list", + "azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations.begin_undelete": "Microsoft.DataProtection.DeletedBackupInstanceResources.undelete", + "azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations.begin_undelete": "Microsoft.DataProtection.DeletedBackupInstanceResources.undelete", + "azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations.get": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.get", + "azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations.get": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.get", + "azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations.create_or_update": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.createOrUpdate", + "azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations.create_or_update": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.createOrUpdate", + "azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations.delete": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.delete", + "azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations.delete": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.delete", + "azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations.list": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.list", + "azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations.list": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.list", + "azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations.unlock_delete": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.unlockDelete", + "azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations.unlock_delete": "Microsoft.DataProtection.ResourceGuardProxyBaseResources.unlockDelete", + "azure.mgmt.dataprotection.operations.OperationResultOperations.get": "Microsoft.DataProtection.OperationResultOperationGroup.get", + "azure.mgmt.dataprotection.aio.operations.OperationResultOperations.get": "Microsoft.DataProtection.OperationResultOperationGroup.get", + "azure.mgmt.dataprotection.operations.OperationStatusOperations.get": "Microsoft.DataProtection.OperationStatusOperationGroup.get", + "azure.mgmt.dataprotection.aio.operations.OperationStatusOperations.get": "Microsoft.DataProtection.OperationStatusOperationGroup.get", + "azure.mgmt.dataprotection.operations.OperationStatusResourceGroupContextOperations.get": "Microsoft.DataProtection.OperationStatusResourceGroupContextOperationGroup.get", + "azure.mgmt.dataprotection.aio.operations.OperationStatusResourceGroupContextOperations.get": "Microsoft.DataProtection.OperationStatusResourceGroupContextOperationGroup.get", + "azure.mgmt.dataprotection.operations.DataProtectionOperations.check_feature_support": "Microsoft.DataProtection.DataProtectionOperationGroup.checkFeatureSupport", + "azure.mgmt.dataprotection.aio.operations.DataProtectionOperations.check_feature_support": "Microsoft.DataProtection.DataProtectionOperationGroup.checkFeatureSupport", + "azure.mgmt.dataprotection.operations.FetchSecondaryRecoveryPointsOperations.list": "Microsoft.DataProtection.FetchSecondaryRecoveryPointsOperationGroup.list", + "azure.mgmt.dataprotection.aio.operations.FetchSecondaryRecoveryPointsOperations.list": "Microsoft.DataProtection.FetchSecondaryRecoveryPointsOperationGroup.list", + "azure.mgmt.dataprotection.operations.FetchCrossRegionRestoreJobOperations.get": "Microsoft.DataProtection.FetchCrossRegionRestoreJobOperationGroup.get", + "azure.mgmt.dataprotection.aio.operations.FetchCrossRegionRestoreJobOperations.get": "Microsoft.DataProtection.FetchCrossRegionRestoreJobOperationGroup.get", + "azure.mgmt.dataprotection.operations.FetchCrossRegionRestoreJobsOperations.list": "Microsoft.DataProtection.FetchCrossRegionRestoreJobsOperationGroup.list", + "azure.mgmt.dataprotection.aio.operations.FetchCrossRegionRestoreJobsOperations.list": "Microsoft.DataProtection.FetchCrossRegionRestoreJobsOperationGroup.list", + "azure.mgmt.dataprotection.operations.BackupInstancesExtensionRoutingOperations.list": "Microsoft.DataProtection.BackupInstancesExtensionRoutingOperationGroup.list", + "azure.mgmt.dataprotection.aio.operations.BackupInstancesExtensionRoutingOperations.list": "Microsoft.DataProtection.BackupInstancesExtensionRoutingOperationGroup.list" + } +} \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py index b8f7d1ce0164..f5526906852e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py @@ -2,25 +2,31 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._data_protection_mgmt_client import DataProtectionMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import DataProtectionClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DataProtectionMgmtClient", + "DataProtectionClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_client.py similarity index 84% rename from sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py rename to sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_client.py index 78bed82f0b26..5ea22b5f23ad 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_mgmt_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_client.py @@ -2,21 +2,23 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models -from ._configuration import DataProtectionMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._configuration import DataProtectionClientConfiguration +from ._utils.serialization import Deserializer, Serializer from .operations import ( BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, @@ -43,41 +45,59 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class DataProtectionClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure Data Protection service. + :ivar data_protection_operations: DataProtectionOperationsOperations operations + :vartype data_protection_operations: + azure.mgmt.dataprotection.operations.DataProtectionOperationsOperations + :ivar backup_instances: BackupInstancesOperations operations + :vartype backup_instances: azure.mgmt.dataprotection.operations.BackupInstancesOperations + :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations + :vartype backup_vault_operation_results: + azure.mgmt.dataprotection.operations.BackupVaultOperationResultsOperations + :ivar resource_guards: ResourceGuardsOperations operations + :vartype resource_guards: azure.mgmt.dataprotection.operations.ResourceGuardsOperations :ivar backup_vaults: BackupVaultsOperations operations :vartype backup_vaults: azure.mgmt.dataprotection.operations.BackupVaultsOperations - :ivar operation_result: OperationResultOperations operations - :vartype operation_result: azure.mgmt.dataprotection.operations.OperationResultOperations - :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.dataprotection.operations.OperationStatusOperations :ivar operation_status_backup_vault_context: OperationStatusBackupVaultContextOperations operations :vartype operation_status_backup_vault_context: azure.mgmt.dataprotection.operations.OperationStatusBackupVaultContextOperations + :ivar export_jobs: ExportJobsOperations operations + :vartype export_jobs: azure.mgmt.dataprotection.operations.ExportJobsOperations + :ivar export_jobs_operation_result: ExportJobsOperationResultOperations operations + :vartype export_jobs_operation_result: + azure.mgmt.dataprotection.operations.ExportJobsOperationResultOperations + :ivar backup_policies: BackupPoliciesOperations operations + :vartype backup_policies: azure.mgmt.dataprotection.operations.BackupPoliciesOperations + :ivar restorable_time_ranges: RestorableTimeRangesOperations operations + :vartype restorable_time_ranges: + azure.mgmt.dataprotection.operations.RestorableTimeRangesOperations + :ivar recovery_points: RecoveryPointsOperations operations + :vartype recovery_points: azure.mgmt.dataprotection.operations.RecoveryPointsOperations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.dataprotection.operations.JobsOperations + :ivar deleted_backup_instances: DeletedBackupInstancesOperations operations + :vartype deleted_backup_instances: + azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations + :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations + :vartype dpp_resource_guard_proxy: + azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations + :ivar operation_result: OperationResultOperations operations + :vartype operation_result: azure.mgmt.dataprotection.operations.OperationResultOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.dataprotection.operations.OperationStatusOperations :ivar operation_status_resource_group_context: OperationStatusResourceGroupContextOperations operations :vartype operation_status_resource_group_context: azure.mgmt.dataprotection.operations.OperationStatusResourceGroupContextOperations - :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations - :vartype backup_vault_operation_results: - azure.mgmt.dataprotection.operations.BackupVaultOperationResultsOperations :ivar data_protection: DataProtectionOperations operations :vartype data_protection: azure.mgmt.dataprotection.operations.DataProtectionOperations - :ivar data_protection_operations: DataProtectionOperationsOperations operations - :vartype data_protection_operations: - azure.mgmt.dataprotection.operations.DataProtectionOperationsOperations - :ivar backup_policies: BackupPoliciesOperations operations - :vartype backup_policies: azure.mgmt.dataprotection.operations.BackupPoliciesOperations - :ivar backup_instances: BackupInstancesOperations operations - :vartype backup_instances: azure.mgmt.dataprotection.operations.BackupInstancesOperations - :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: azure.mgmt.dataprotection.operations.RecoveryPointsOperations :ivar fetch_secondary_recovery_points: FetchSecondaryRecoveryPointsOperations operations :vartype fetch_secondary_recovery_points: azure.mgmt.dataprotection.operations.FetchSecondaryRecoveryPointsOperations @@ -90,32 +110,17 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :ivar backup_instances_extension_routing: BackupInstancesExtensionRoutingOperations operations :vartype backup_instances_extension_routing: azure.mgmt.dataprotection.operations.BackupInstancesExtensionRoutingOperations - :ivar jobs: JobsOperations operations - :vartype jobs: azure.mgmt.dataprotection.operations.JobsOperations - :ivar restorable_time_ranges: RestorableTimeRangesOperations operations - :vartype restorable_time_ranges: - azure.mgmt.dataprotection.operations.RestorableTimeRangesOperations - :ivar export_jobs: ExportJobsOperations operations - :vartype export_jobs: azure.mgmt.dataprotection.operations.ExportJobsOperations - :ivar export_jobs_operation_result: ExportJobsOperationResultOperations operations - :vartype export_jobs_operation_result: - azure.mgmt.dataprotection.operations.ExportJobsOperationResultOperations - :ivar deleted_backup_instances: DeletedBackupInstancesOperations operations - :vartype deleted_backup_instances: - azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations - :ivar resource_guards: ResourceGuardsOperations operations - :vartype resource_guards: azure.mgmt.dataprotection.operations.ResourceGuardsOperations - :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations - :vartype dpp_resource_guard_proxy: - azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-07-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -125,12 +130,26 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - self._config = DataProtectionMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DataProtectionClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -149,72 +168,71 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.backup_vaults = BackupVaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_result = OperationResultOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.operation_status = OperationStatusOperations( + self.data_protection_operations = DataProtectionOperationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_status_backup_vault_context = OperationStatusBackupVaultContextOperations( + self.backup_instances = BackupInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_status_resource_group_context = OperationStatusResourceGroupContextOperations( + self.backup_vault_operation_results = BackupVaultOperationResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.backup_vault_operation_results = BackupVaultOperationResultsOperations( + self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_vaults = BackupVaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status_backup_vault_context = OperationStatusBackupVaultContextOperations( self._client, self._config, self._serialize, self._deserialize ) - self.data_protection = DataProtectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_protection_operations = DataProtectionOperationsOperations( + self.export_jobs = ExportJobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_jobs_operation_result = ExportJobsOperationResultOperations( self._client, self._config, self._serialize, self._deserialize ) self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_instances = BackupInstancesOperations( + self.restorable_time_ranges = RestorableTimeRangesOperations( self._client, self._config, self._serialize, self._deserialize ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.fetch_secondary_recovery_points = FetchSecondaryRecoveryPointsOperations( + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_backup_instances = DeletedBackupInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fetch_cross_region_restore_job = FetchCrossRegionRestoreJobOperations( + self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fetch_cross_region_restore_jobs = FetchCrossRegionRestoreJobsOperations( + self.operation_result = OperationResultOperations( self._client, self._config, self._serialize, self._deserialize ) - self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( + self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_time_ranges = RestorableTimeRangesOperations( + self.operation_status_resource_group_context = OperationStatusResourceGroupContextOperations( self._client, self._config, self._serialize, self._deserialize ) - self.export_jobs = ExportJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.export_jobs_operation_result = ExportJobsOperationResultOperations( + self.data_protection = DataProtectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.fetch_secondary_recovery_points = FetchSecondaryRecoveryPointsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.deleted_backup_instances = DeletedBackupInstancesOperations( + self.fetch_cross_region_restore_job = FetchCrossRegionRestoreJobOperations( self._client, self._config, self._serialize, self._deserialize ) - self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( + self.fetch_cross_region_restore_jobs = FetchCrossRegionRestoreJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -227,13 +245,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "DataProtectionMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py index cbd666b18f43..ae2943eacb5e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,27 +14,39 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DataProtectionMgmtClient. +class DataProtectionClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for DataProtectionClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-07-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +55,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-dataprotection/{}".format(VERSION)) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/__init__.py similarity index 50% rename from sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py rename to sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/__init__.py index 0dafe0e287ff..8026245c2abc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_vendor.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/__init__.py @@ -1,16 +1,6 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/model_base.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/model_base.py new file mode 100644 index 000000000000..12926fa98dcf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/model_base.py @@ -0,0 +1,1237 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_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}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _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") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/serialization.py similarity index 82% rename from sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py rename to sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/serialization.py index f0c6180722c8..e81921cbb011 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -39,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -48,11 +29,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, - List, - Mapping, ) try: @@ -62,13 +39,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +68,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :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. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +91,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +123,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +134,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -177,80 +163,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], 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 # type: ignore -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 -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +242,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +278,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,12 +302,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -378,12 +338,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,30 +356,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -424,9 +388,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +412,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +469,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +510,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -554,17 +526,20 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = 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): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object 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. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,17 +565,19 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + 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) + serialized |= target_obj.additional_properties continue try: @@ -631,7 +608,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore 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 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 @@ -662,17 +640,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object 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 + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +679,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,11 +688,13 @@ def body(self, 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 name: The name of the URL path parameter. + :param object 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 + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -726,21 +706,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +736,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 name: The name of the header. + :param object 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 + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +758,20 @@ def header(self, name, data, data_type, **kwargs): 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) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + 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 object 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. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +782,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +798,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +817,26 @@ def serialize_basic(cls, data, data_type, **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 obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ 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 + return eval(data_type)(data) # nosec # pylint: disable=eval-used @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. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +850,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +860,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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 list data: 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'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +921,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :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 + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +946,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """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 @@ -977,6 +954,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +979,7 @@ def serialize_object(self, attr, **kwargs): 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): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1010,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore 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)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1072,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1087,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ 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.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1125,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1157,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """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 + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,17 +1172,17 @@ def serialize_unix(attr, **kwargs): 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.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1209,7 +1197,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1220,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, 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.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ 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): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """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" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1279,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1331,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + 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 - ) + # 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. + ) + 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: @@ -1352,7 +1353,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1362,9 @@ class Deserializer(object): 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1383,7 +1384,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = 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 @@ -1399,27 +1400,29 @@ def __call__(self, target_obj, response_data, content_type=None): :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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: 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(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1441,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1477,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + 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: @@ -1503,6 +1505,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1518,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1533,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1556,12 @@ def _unpack_content(raw_data, content_type=None): 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. + :param obj raw_data: Data to be processed. + :param str 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 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1585,35 @@ def _unpack_content(raw_data, content_type=None): 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. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ 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")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + 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 + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1622,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """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. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1645,11 @@ def deserialize_data(self, data, data_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"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "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) @@ -1645,14 +1669,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + 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. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1693,7 @@ def deserialize_dict(self, attr, dict_type): :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. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,13 +1704,14 @@ def deserialize_dict(self, attr, dict_type): 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): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1718,11 +1744,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """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 @@ -1730,8 +1755,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :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 @@ -1741,24 +1767,23 @@ def deserialize_basic(self, attr, data_type): 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 + # 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, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if 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 + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1791,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1805,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1817,7 @@ def deserialize_enum(data, enum_obj): :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. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1828,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,8 +1846,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1832,8 +1859,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1847,8 +1875,9 @@ 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. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,8 +1892,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1875,8 +1905,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1885,16 +1916,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1908,8 +1939,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1922,31 +1954,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(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 DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1974,8 +2007,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,8 +2015,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1994,5 +2027,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py index b97926d4bc86..8f2350dd3b0c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py @@ -2,8 +2,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.4.0" +VERSION = "2.0.0" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py index b1b173bd7e27..d3fd2437cc30 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py @@ -2,22 +2,28 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._data_protection_mgmt_client import DataProtectionMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import DataProtectionClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "DataProtectionMgmtClient", + "DataProtectionClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_client.py similarity index 84% rename from sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py rename to sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_client.py index bc03bbf9f6da..395689c20ef0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_mgmt_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_client.py @@ -2,21 +2,23 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import DataProtectionMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer +from ._configuration import DataProtectionClientConfiguration from .operations import ( BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, @@ -43,41 +45,59 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class DataProtectionClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure Data Protection service. + :ivar data_protection_operations: DataProtectionOperationsOperations operations + :vartype data_protection_operations: + azure.mgmt.dataprotection.aio.operations.DataProtectionOperationsOperations + :ivar backup_instances: BackupInstancesOperations operations + :vartype backup_instances: azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations + :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations + :vartype backup_vault_operation_results: + azure.mgmt.dataprotection.aio.operations.BackupVaultOperationResultsOperations + :ivar resource_guards: ResourceGuardsOperations operations + :vartype resource_guards: azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations :ivar backup_vaults: BackupVaultsOperations operations :vartype backup_vaults: azure.mgmt.dataprotection.aio.operations.BackupVaultsOperations - :ivar operation_result: OperationResultOperations operations - :vartype operation_result: azure.mgmt.dataprotection.aio.operations.OperationResultOperations - :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.dataprotection.aio.operations.OperationStatusOperations :ivar operation_status_backup_vault_context: OperationStatusBackupVaultContextOperations operations :vartype operation_status_backup_vault_context: azure.mgmt.dataprotection.aio.operations.OperationStatusBackupVaultContextOperations + :ivar export_jobs: ExportJobsOperations operations + :vartype export_jobs: azure.mgmt.dataprotection.aio.operations.ExportJobsOperations + :ivar export_jobs_operation_result: ExportJobsOperationResultOperations operations + :vartype export_jobs_operation_result: + azure.mgmt.dataprotection.aio.operations.ExportJobsOperationResultOperations + :ivar backup_policies: BackupPoliciesOperations operations + :vartype backup_policies: azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations + :ivar restorable_time_ranges: RestorableTimeRangesOperations operations + :vartype restorable_time_ranges: + azure.mgmt.dataprotection.aio.operations.RestorableTimeRangesOperations + :ivar recovery_points: RecoveryPointsOperations operations + :vartype recovery_points: azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations + :ivar jobs: JobsOperations operations + :vartype jobs: azure.mgmt.dataprotection.aio.operations.JobsOperations + :ivar deleted_backup_instances: DeletedBackupInstancesOperations operations + :vartype deleted_backup_instances: + azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations + :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations + :vartype dpp_resource_guard_proxy: + azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations + :ivar operation_result: OperationResultOperations operations + :vartype operation_result: azure.mgmt.dataprotection.aio.operations.OperationResultOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: azure.mgmt.dataprotection.aio.operations.OperationStatusOperations :ivar operation_status_resource_group_context: OperationStatusResourceGroupContextOperations operations :vartype operation_status_resource_group_context: azure.mgmt.dataprotection.aio.operations.OperationStatusResourceGroupContextOperations - :ivar backup_vault_operation_results: BackupVaultOperationResultsOperations operations - :vartype backup_vault_operation_results: - azure.mgmt.dataprotection.aio.operations.BackupVaultOperationResultsOperations :ivar data_protection: DataProtectionOperations operations :vartype data_protection: azure.mgmt.dataprotection.aio.operations.DataProtectionOperations - :ivar data_protection_operations: DataProtectionOperationsOperations operations - :vartype data_protection_operations: - azure.mgmt.dataprotection.aio.operations.DataProtectionOperationsOperations - :ivar backup_policies: BackupPoliciesOperations operations - :vartype backup_policies: azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations - :ivar backup_instances: BackupInstancesOperations operations - :vartype backup_instances: azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations - :ivar recovery_points: RecoveryPointsOperations operations - :vartype recovery_points: azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations :ivar fetch_secondary_recovery_points: FetchSecondaryRecoveryPointsOperations operations :vartype fetch_secondary_recovery_points: azure.mgmt.dataprotection.aio.operations.FetchSecondaryRecoveryPointsOperations @@ -90,32 +110,17 @@ class DataProtectionMgmtClient: # pylint: disable=client-accepts-api-version-ke :ivar backup_instances_extension_routing: BackupInstancesExtensionRoutingOperations operations :vartype backup_instances_extension_routing: azure.mgmt.dataprotection.aio.operations.BackupInstancesExtensionRoutingOperations - :ivar jobs: JobsOperations operations - :vartype jobs: azure.mgmt.dataprotection.aio.operations.JobsOperations - :ivar restorable_time_ranges: RestorableTimeRangesOperations operations - :vartype restorable_time_ranges: - azure.mgmt.dataprotection.aio.operations.RestorableTimeRangesOperations - :ivar export_jobs: ExportJobsOperations operations - :vartype export_jobs: azure.mgmt.dataprotection.aio.operations.ExportJobsOperations - :ivar export_jobs_operation_result: ExportJobsOperationResultOperations operations - :vartype export_jobs_operation_result: - azure.mgmt.dataprotection.aio.operations.ExportJobsOperationResultOperations - :ivar deleted_backup_instances: DeletedBackupInstancesOperations operations - :vartype deleted_backup_instances: - azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations - :ivar resource_guards: ResourceGuardsOperations operations - :vartype resource_guards: azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations - :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations - :vartype dpp_resource_guard_proxy: - azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-07-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -125,12 +130,26 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - self._config = DataProtectionMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DataProtectionClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -149,66 +168,67 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.backup_vaults = BackupVaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_result = OperationResultOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.operation_status = OperationStatusOperations( + self.data_protection_operations = DataProtectionOperationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_status_backup_vault_context = OperationStatusBackupVaultContextOperations( + self.backup_instances = BackupInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_status_resource_group_context = OperationStatusResourceGroupContextOperations( + self.backup_vault_operation_results = BackupVaultOperationResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.backup_vault_operation_results = BackupVaultOperationResultsOperations( + self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_vaults = BackupVaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status_backup_vault_context = OperationStatusBackupVaultContextOperations( self._client, self._config, self._serialize, self._deserialize ) - self.data_protection = DataProtectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_protection_operations = DataProtectionOperationsOperations( + self.export_jobs = ExportJobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.export_jobs_operation_result = ExportJobsOperationResultOperations( self._client, self._config, self._serialize, self._deserialize ) self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.backup_instances = BackupInstancesOperations( + self.restorable_time_ranges = RestorableTimeRangesOperations( self._client, self._config, self._serialize, self._deserialize ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) - self.fetch_secondary_recovery_points = FetchSecondaryRecoveryPointsOperations( + self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_backup_instances = DeletedBackupInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fetch_cross_region_restore_job = FetchCrossRegionRestoreJobOperations( + self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( self._client, self._config, self._serialize, self._deserialize ) - self.fetch_cross_region_restore_jobs = FetchCrossRegionRestoreJobsOperations( + self.operation_result = OperationResultOperations( self._client, self._config, self._serialize, self._deserialize ) - self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( + self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.restorable_time_ranges = RestorableTimeRangesOperations( + self.operation_status_resource_group_context = OperationStatusResourceGroupContextOperations( self._client, self._config, self._serialize, self._deserialize ) - self.export_jobs = ExportJobsOperations(self._client, self._config, self._serialize, self._deserialize) - self.export_jobs_operation_result = ExportJobsOperationResultOperations( + self.data_protection = DataProtectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.fetch_secondary_recovery_points = FetchSecondaryRecoveryPointsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.deleted_backup_instances = DeletedBackupInstancesOperations( + self.fetch_cross_region_restore_job = FetchCrossRegionRestoreJobOperations( self._client, self._config, self._serialize, self._deserialize ) - self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( + self.fetch_cross_region_restore_jobs = FetchCrossRegionRestoreJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( self._client, self._config, self._serialize, self._deserialize ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -216,7 +236,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -229,13 +249,17 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "DataProtectionMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py index 4809b5ab60c7..37d1840822e2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,27 +14,39 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class DataProtectionMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DataProtectionMgmtClient. +class DataProtectionClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for DataProtectionClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-07-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +55,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-dataprotection/{}".format(VERSION)) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py index 42904f5f3feb..f58feb19c84b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py @@ -2,60 +2,66 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._backup_vaults_operations import BackupVaultsOperations -from ._operation_result_operations import OperationResultOperations -from ._operation_status_operations import OperationStatusOperations -from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations -from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations -from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations -from ._data_protection_operations import DataProtectionOperations -from ._data_protection_operations_operations import DataProtectionOperationsOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._backup_instances_operations import BackupInstancesOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._fetch_secondary_recovery_points_operations import FetchSecondaryRecoveryPointsOperations -from ._fetch_cross_region_restore_job_operations import FetchCrossRegionRestoreJobOperations -from ._fetch_cross_region_restore_jobs_operations import FetchCrossRegionRestoreJobsOperations -from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations -from ._jobs_operations import JobsOperations -from ._restorable_time_ranges_operations import RestorableTimeRangesOperations -from ._export_jobs_operations import ExportJobsOperations -from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations -from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations -from ._resource_guards_operations import ResourceGuardsOperations -from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import DataProtectionOperationsOperations # type: ignore +from ._operations import BackupInstancesOperations # type: ignore +from ._operations import BackupVaultOperationResultsOperations # type: ignore +from ._operations import ResourceGuardsOperations # type: ignore +from ._operations import BackupVaultsOperations # type: ignore +from ._operations import OperationStatusBackupVaultContextOperations # type: ignore +from ._operations import ExportJobsOperations # type: ignore +from ._operations import ExportJobsOperationResultOperations # type: ignore +from ._operations import BackupPoliciesOperations # type: ignore +from ._operations import RestorableTimeRangesOperations # type: ignore +from ._operations import RecoveryPointsOperations # type: ignore +from ._operations import JobsOperations # type: ignore +from ._operations import DeletedBackupInstancesOperations # type: ignore +from ._operations import DppResourceGuardProxyOperations # type: ignore +from ._operations import OperationResultOperations # type: ignore +from ._operations import OperationStatusOperations # type: ignore +from ._operations import OperationStatusResourceGroupContextOperations # type: ignore +from ._operations import DataProtectionOperations # type: ignore +from ._operations import FetchSecondaryRecoveryPointsOperations # type: ignore +from ._operations import FetchCrossRegionRestoreJobOperations # type: ignore +from ._operations import FetchCrossRegionRestoreJobsOperations # type: ignore +from ._operations import BackupInstancesExtensionRoutingOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "DataProtectionOperationsOperations", + "BackupInstancesOperations", + "BackupVaultOperationResultsOperations", + "ResourceGuardsOperations", "BackupVaultsOperations", + "OperationStatusBackupVaultContextOperations", + "ExportJobsOperations", + "ExportJobsOperationResultOperations", + "BackupPoliciesOperations", + "RestorableTimeRangesOperations", + "RecoveryPointsOperations", + "JobsOperations", + "DeletedBackupInstancesOperations", + "DppResourceGuardProxyOperations", "OperationResultOperations", "OperationStatusOperations", - "OperationStatusBackupVaultContextOperations", "OperationStatusResourceGroupContextOperations", - "BackupVaultOperationResultsOperations", "DataProtectionOperations", - "DataProtectionOperationsOperations", - "BackupPoliciesOperations", - "BackupInstancesOperations", - "RecoveryPointsOperations", "FetchSecondaryRecoveryPointsOperations", "FetchCrossRegionRestoreJobOperations", "FetchCrossRegionRestoreJobsOperations", "BackupInstancesExtensionRoutingOperations", - "JobsOperations", - "RestorableTimeRangesOperations", - "ExportJobsOperations", - "ExportJobsOperationResultOperations", - "DeletedBackupInstancesOperations", - "ResourceGuardsOperations", - "DppResourceGuardProxyOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py deleted file mode 100644 index 6f907f4bc8a5..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py +++ /dev/null @@ -1,139 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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._backup_instances_extension_routing_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BackupInstancesExtensionRoutingOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`backup_instances_extension_routing` 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_id: str, **kwargs: Any) -> AsyncIterable["_models.BackupInstanceResource"]: - """Gets a list of backup instances associated with a tracked resource. - - :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. - Required. - :type resource_id: str - :return: An iterator like instance of either BackupInstanceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_id=resource_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py deleted file mode 100644 index f4516e77747a..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py +++ /dev/null @@ -1,2942 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._backup_instances_operations import ( - build_adhoc_backup_request, - build_create_or_update_request, - build_delete_request, - build_get_backup_instance_operation_result_request, - build_get_request, - build_list_request, - build_resume_backups_request, - build_resume_protection_request, - build_stop_protection_request, - build_suspend_backups_request, - build_sync_backup_instance_request, - build_trigger_cross_region_restore_request, - build_trigger_rehydrate_request, - build_trigger_restore_request, - build_validate_cross_region_restore_request, - build_validate_for_backup_request, - build_validate_for_restore_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BackupInstancesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`backup_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BackupInstanceResource"]: - """Gets a backup instances belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either BackupInstanceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> _models.BackupInstanceResource: - """Gets a backup instance with name in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :return: BackupInstanceResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.BackupInstanceResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> Optional[_models.BackupInstanceResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupInstanceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.BackupInstanceResource, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInstanceResource]: - """Create or update a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BackupInstanceResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInstanceResource]: - """Create or update a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BackupInstanceResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.BackupInstanceResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInstanceResource]: - """Create or update a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a BackupInstanceResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of AsyncLROPoller that returns either BackupInstanceResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BackupInstanceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BackupInstanceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _adhoc_backup_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.TriggerBackupRequest, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TriggerBackupRequest") - - _request = build_adhoc_backup_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_adhoc_backup( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.TriggerBackupRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Trigger adhoc backup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_adhoc_backup( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Trigger adhoc backup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_adhoc_backup( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.TriggerBackupRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Trigger adhoc backup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a TriggerBackupRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._adhoc_backup_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_for_backup_initial( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.ValidateForBackupRequest, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ValidateForBackupRequest") - - _request = build_validate_for_backup_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_for_backup( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.ValidateForBackupRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validate whether adhoc backup will be successful or not. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_for_backup( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validate whether adhoc backup will be successful or not. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_for_backup( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.ValidateForBackupRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validate whether adhoc backup will be successful or not. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Is either a ValidateForBackupRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_for_backup_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get_backup_instance_operation_result( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.BackupInstanceResource]: - """Get result of backup instance creation operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param operation_id: Required. - :type operation_id: str - :return: BackupInstanceResource or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) - - _request = build_get_backup_instance_operation_result_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _trigger_cross_region_restore_initial( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CrossRegionRestoreRequestObject") - - _request = build_trigger_cross_region_restore_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_trigger_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: _models.CrossRegionRestoreRequestObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Triggers Cross Region Restore for BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for trigger CRR operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_trigger_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Triggers Cross Region Restore for BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for trigger CRR operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_trigger_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Triggers Cross Region Restore for BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for trigger CRR operation. Is either a - CrossRegionRestoreRequestObject type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._trigger_cross_region_restore_initial( - resource_group_name=resource_group_name, - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _validate_cross_region_restore_initial( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ValidateCrossRegionRestoreRequestObject") - - _request = build_validate_cross_region_restore_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: _models.ValidateCrossRegionRestoreRequestObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validates whether Cross Region Restore can be triggered for DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validates whether Cross Region Restore can be triggered for DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validates whether Cross Region Restore can be triggered for DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a - ValidateCrossRegionRestoreRequestObject type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_cross_region_restore_initial( - resource_group_name=resource_group_name, - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRehydrationRequest, IO[bytes]], - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AzureBackupRehydrationRequest") - - _request = build_trigger_rehydrate_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - async def begin_trigger_rehydrate( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.AzureBackupRehydrationRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """rehydrate recovery point for restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_rehydrate( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """rehydrate recovery point for restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_rehydrate( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRehydrationRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """rehydrate recovery point for restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a AzureBackupRehydrationRequest type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._trigger_rehydrate_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _trigger_restore_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRestoreRequest, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AzureBackupRestoreRequest") - - _request = build_trigger_restore_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_trigger_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.AzureBackupRestoreRequest, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Triggers restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_trigger_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Triggers restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_trigger_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRestoreRequest, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Triggers restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a AzureBackupRestoreRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._trigger_restore_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _resume_backups_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_resume_backups_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_resume_backups( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will resume backups for backup instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._resume_backups_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _resume_protection_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_resume_protection_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_resume_protection( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will resume protection for a stopped backup instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._resume_protection_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_protection_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.StopProtectionRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "StopProtectionRequest") - else: - _json = None - - _request = build_stop_protection_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - async def begin_stop_protection( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[_models.StopProtectionRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will stop protection of a backup instance and data will be held forever. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_stop_protection( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will stop protection of a backup instance and data will be held forever. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_stop_protection( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.StopProtectionRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will stop protection of a backup instance and data will be held forever. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Is either a StopProtectionRequest type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_protection_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.SuspendBackupRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "SuspendBackupRequest") - else: - _json = None - - _request = build_suspend_backups_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - async def begin_suspend_backups( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[_models.SuspendBackupRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will stop backup for a backup instance and retains the backup data as per the - policy (except latest Recovery point, which will be retained forever). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_suspend_backups( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will stop backup for a backup instance and retains the backup data as per the - policy (except latest Recovery point, which will be retained forever). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_suspend_backups( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.SuspendBackupRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """This operation will stop backup for a backup instance and retains the backup data as per the - policy (except latest Recovery point, which will be retained forever). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Is either a SuspendBackupRequest type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._suspend_backups_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.SyncBackupInstanceRequest, IO[bytes]], - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SyncBackupInstanceRequest") - - _request = build_sync_backup_instance_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - async def begin_sync_backup_instance( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.SyncBackupInstanceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Sync backup instance again in case of failure - This action will retry last failed operation and will bring backup instance to valid state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_sync_backup_instance( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Sync backup instance again in case of failure - This action will retry last failed operation and will bring backup instance to valid state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_sync_backup_instance( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.SyncBackupInstanceRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Sync backup instance again in case of failure - This action will retry last failed operation and will bring backup instance to valid state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a SyncBackupInstanceRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._sync_backup_instance_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _validate_for_restore_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.ValidateRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ValidateRestoreRequestObject") - - _request = build_validate_for_restore_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_for_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.ValidateRestoreRequestObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validates if Restore can be triggered for a DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_for_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validates if Restore can be triggered for a DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_for_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.ValidateRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: - """Validates if Restore can be triggered for a DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a ValidateRestoreRequestObject type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject or IO[bytes] - :return: An instance of AsyncLROPoller that returns either OperationJobExtendedInfo or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._validate_for_restore_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py deleted file mode 100644 index d646d8a8e95c..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py +++ /dev/null @@ -1,421 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._backup_policies_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BackupPoliciesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`backup_policies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BaseBackupPolicyResource"]: - """Returns list of backup policies belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either BaseBackupPolicyResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BaseBackupPolicyResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Gets a backup policy belonging to a backup vault. - - Gets a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Required. - :type backup_policy_name: str - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_policy_name=backup_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_policy_name: str, - parameters: _models.BaseBackupPolicyResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Creates or Updates a backup policy belonging to a backup vault. - - Creates or Updates a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Name of the policy. Required. - :type backup_policy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_policy_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Creates or Updates a backup policy belonging to a backup vault. - - Creates or Updates a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Name of the policy. Required. - :type backup_policy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_policy_name: str, - parameters: Union[_models.BaseBackupPolicyResource, IO[bytes]], - **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Creates or Updates a backup policy belonging to a backup vault. - - Creates or Updates a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Name of the policy. Required. - :type backup_policy_name: str - :param parameters: Request body for operation. Is either a BaseBackupPolicyResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource or IO[bytes] - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BaseBackupPolicyResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_policy_name=backup_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any - ) -> None: - """Deletes a backup policy belonging to a backup vault. - - Deletes a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Required. - :type backup_policy_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_policy_name=backup_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py deleted file mode 100644 index f94da8c73e36..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py +++ /dev/null @@ -1,127 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._backup_vault_operation_results_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BackupVaultOperationResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`backup_vault_operation_results` 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_async - async def get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.BackupVaultResource]: - """get. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param operation_id: Required. - :type operation_id: str - :return: BackupVaultResource or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py deleted file mode 100644 index d51831a43ebe..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py +++ /dev/null @@ -1,930 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._backup_vaults_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_get_in_resource_group_request, - build_get_in_subscription_request, - build_get_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BackupVaultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`backup_vaults` 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 get_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BackupVaultResource"]: - """Returns resource collection belonging to a subscription. - - :return: An iterator like instance of either BackupVaultResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_in_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_in_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BackupVaultResource"]: - """Returns resource collection belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either BackupVaultResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_in_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.BackupVaultResource: - """Returns a resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: BackupVaultResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.BackupVaultResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> _models.BackupVaultResource: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupVaultResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.BackupVaultResource, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupVaultResource]: - """Creates or updates a BackupVault resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupVaultResource]: - """Creates or updates a BackupVault resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.BackupVaultResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupVaultResource]: - """Creates or updates a BackupVault resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Is either a BackupVaultResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BackupVaultResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BackupVaultResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a BackupVault resource from the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.PatchResourceRequestInput, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> Optional[_models.BackupVaultResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PatchResourceRequestInput") - - _request = build_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.PatchResourceRequestInput, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupVaultResource]: - """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupVaultResource]: - """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.PatchResourceRequestInput, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupVaultResource]: - """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Is either a PatchResourceRequestInput type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of AsyncLROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BackupVaultResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BackupVaultResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def check_name_availability( - self, - resource_group_name: str, - location: str, - parameters: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """API to check for resource name availability. - - API to check for resource name availability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param parameters: Check name availability request. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """API to check for resource name availability. - - API to check for resource name availability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param parameters: Check name availability request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """API to check for resource name availability. - - API to check for resource name availability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param parameters: Check name availability request. Is either a CheckNameAvailabilityRequest - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest or IO[bytes] - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") - - _request = build_check_name_availability_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py deleted file mode 100644 index c552d0210668..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py +++ /dev/null @@ -1,173 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, 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 -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._data_protection_operations import build_check_feature_support_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DataProtectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`data_protection` 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") - - @overload - async def check_feature_support( - self, - location: str, - parameters: _models.FeatureValidationRequestBase, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FeatureValidationResponseBase: - """Validates if a feature is supported. - - Validates if a feature is supported. - - :param location: Required. - :type location: str - :param parameters: Feature support request object. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FeatureValidationResponseBase or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_feature_support( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.FeatureValidationResponseBase: - """Validates if a feature is supported. - - Validates if a feature is supported. - - :param location: Required. - :type location: str - :param parameters: Feature support request object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: FeatureValidationResponseBase or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_feature_support( - self, location: str, parameters: Union[_models.FeatureValidationRequestBase, IO[bytes]], **kwargs: Any - ) -> _models.FeatureValidationResponseBase: - """Validates if a feature is supported. - - Validates if a feature is supported. - - :param location: Required. - :type location: str - :param parameters: Feature support request object. Is either a FeatureValidationRequestBase - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase or IO[bytes] - :return: FeatureValidationResponseBase or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FeatureValidationResponseBase] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FeatureValidationRequestBase") - - _request = build_check_feature_support_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FeatureValidationResponseBase", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py deleted file mode 100644 index 912bd4e4e294..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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._data_protection_operations_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DataProtectionOperationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`data_protection_operations` 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, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForSingleApi"]: - """Returns the list of available operations. - - :return: An iterator like instance of either ClientDiscoveryValueForSingleApi or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py deleted file mode 100644 index 212356896b93..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py +++ /dev/null @@ -1,313 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast -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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deleted_backup_instances_operations import ( - build_get_request, - build_list_request, - build_undelete_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DeletedBackupInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`deleted_backup_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DeletedBackupInstanceResource"]: - """Gets deleted backup instances belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either DeletedBackupInstanceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedBackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> _models.DeletedBackupInstanceResource: - """Gets a deleted backup instance with name in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the deleted backup instance. Required. - :type backup_instance_name: str - :return: DeletedBackupInstanceResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedBackupInstanceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _undelete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_undelete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def begin_undelete( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """undelete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the deleted backup instance. Required. - :type backup_instance_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._undelete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py deleted file mode 100644 index cc99bad65d1c..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py +++ /dev/null @@ -1,583 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dpp_resource_guard_proxy_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_unlock_delete_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DppResourceGuardProxyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`dpp_resource_guard_proxy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ResourceGuardProxyBaseResource"]: - """Returns the list of ResourceGuardProxies associated with the vault. - - Returns the list of ResourceGuardProxies associated with the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in - the request. - - Returns the ResourceGuardProxy object associated with the vault, and that matches the name in - the request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.ResourceGuardProxyBaseResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Creates or Updates a ResourceGuardProxy. - - Creates or Updates a ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Creates or Updates a ResourceGuardProxy. - - Creates or Updates a ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.ResourceGuardProxyBaseResource, IO[bytes]], - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Creates or Updates a ResourceGuardProxy. - - Creates or Updates a ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a ResourceGuardProxyBaseResource type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO[bytes] - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> None: - """Deletes the ResourceGuardProxy. - - Deletes the ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.UnlockDeleteRequest, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.UnlockDeleteRequest, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a UnlockDeleteRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "UnlockDeleteRequest") - - _request = build_unlock_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py deleted file mode 100644 index a7a02c5779dc..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py +++ /dev/null @@ -1,121 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._export_jobs_operation_result_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ExportJobsOperationResultOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`export_jobs_operation_result` 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_async - async def get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.ExportJobsResult]: - """Gets the operation result of operation triggered by Export Jobs API. If the operation is - successful, then it also contains URL of a Blob and a SAS key to access the same. The blob - contains exported jobs in JSON serialized format. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param operation_id: OperationID which represents the export job. Required. - :type operation_id: str - :return: ExportJobsResult or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ExportJobsResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py deleted file mode 100644 index d91fe57fa53f..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py +++ /dev/null @@ -1,159 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast - -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._export_jobs_operations import build_trigger_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ExportJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`export_jobs` 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") - - async def _trigger_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_trigger_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Triggers export of jobs and returns an OperationID to track. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._trigger_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py deleted file mode 100644 index 5f14535bfe3d..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_job_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, 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 -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._fetch_cross_region_restore_job_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FetchCrossRegionRestoreJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`fetch_cross_region_restore_job` 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") - - @overload - async def get( - self, - resource_group_name: str, - location: str, - parameters: _models.CrossRegionRestoreJobRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Fetches the Cross Region Restore Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Fetches the Cross Region Restore Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreJobRequest, IO[bytes]], - **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Fetches the Cross Region Restore Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a CrossRegionRestoreJobRequest type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest or IO[bytes] - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CrossRegionRestoreJobRequest") - - _request = build_get_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupJobResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_jobs_operations.py deleted file mode 100644 index 9f1db3d2308c..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_cross_region_restore_jobs_operations.py +++ /dev/null @@ -1,232 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._fetch_cross_region_restore_jobs_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FetchCrossRegionRestoreJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`fetch_cross_region_restore_jobs` 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") - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: _models.CrossRegionRestoreJobsRequest, - filter: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupJobResource"]: - """Fetches list of Cross Region Restore job belonging to the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest - :param filter: OData filter options. Default value is None. - :type filter: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - filter: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupJobResource"]: - """Fetches list of Cross Region Restore job belonging to the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param filter: OData filter options. Default value is None. - :type filter: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def list( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreJobsRequest, IO[bytes]], - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupJobResource"]: - """Fetches list of Cross Region Restore job belonging to the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a CrossRegionRestoreJobsRequest type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest or IO[bytes] - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CrossRegionRestoreJobsRequest") - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_recovery_points_operations.py deleted file mode 100644 index b465e6646780..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_fetch_secondary_recovery_points_operations.py +++ /dev/null @@ -1,246 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._fetch_secondary_recovery_points_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FetchSecondaryRecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`fetch_secondary_recovery_points` 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") - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: _models.FetchSecondaryRPsRequestParameters, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for - Cross Region Restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters - :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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - filter: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for - Cross Region Restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def list( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.FetchSecondaryRPsRequestParameters, IO[bytes]], - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for - Cross Region Restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a FetchSecondaryRPsRequestParameters - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters or - IO[bytes] - :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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FetchSecondaryRPsRequestParameters") - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py deleted file mode 100644 index f4e6b3a0086b..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py +++ /dev/null @@ -1,208 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._jobs_operations import build_get_request, build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class JobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupJobResource"]: - """Returns list of jobs belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Gets a job with id in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param job_id: The Job ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. - :type job_id: str - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - job_id=job_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupJobResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py deleted file mode 100644 index 1c74470597be..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py +++ /dev/null @@ -1,123 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operation_result_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationResultOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`operation_result` 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_async - async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_models.OperationJobExtendedInfo]: - """Gets the operation status for a resource. - - Gets the operation result for a resource. - - :param operation_id: Required. - :type operation_id: str - :param location: Required. - :type location: str - :return: OperationJobExtendedInfo or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - _request = build_get_request( - operation_id=operation_id, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py deleted file mode 100644 index 3078ec50e73e..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py +++ /dev/null @@ -1,119 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operation_status_backup_vault_context_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationStatusBackupVaultContextOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`operation_status_backup_vault_context` 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_async - async def get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationResource: - """Gets the operation status for an operation over a BackupVault's context. - - Gets the operation status for an operation over a BackupVault's context. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param operation_id: Required. - :type operation_id: str - :return: OperationResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py deleted file mode 100644 index c2c72b92dfd5..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py +++ /dev/null @@ -1,113 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operation_status_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`operation_status` 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_async - async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: - """Gets the operation status for a resource. - - Gets the operation status for a resource. - - :param location: Required. - :type location: str - :param operation_id: Required. - :type operation_id: str - :return: OperationResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py deleted file mode 100644 index ef225510cb0f..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py +++ /dev/null @@ -1,114 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operation_status_resource_group_context_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationStatusResourceGroupContextOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`operation_status_resource_group_context` 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_async - async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: - """Gets the operation status for an operation over a ResourceGroup's context. - - Gets the operation status for an operation over a ResourceGroup's context. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param operation_id: Required. - :type operation_id: str - :return: OperationResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operations.py new file mode 100644 index 000000000000..69e08e1a601a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operations.py @@ -0,0 +1,10124 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_backup_instances_adhoc_backup_request, + build_backup_instances_create_or_update_request, + build_backup_instances_delete_request, + build_backup_instances_extension_routing_list_request, + build_backup_instances_get_backup_instance_operation_result_request, + build_backup_instances_get_request, + build_backup_instances_list_request, + build_backup_instances_resume_backups_request, + build_backup_instances_resume_protection_request, + build_backup_instances_stop_protection_request, + build_backup_instances_suspend_backups_request, + build_backup_instances_sync_backup_instance_request, + build_backup_instances_trigger_cross_region_restore_request, + build_backup_instances_trigger_rehydrate_request, + build_backup_instances_trigger_restore_request, + build_backup_instances_validate_cross_region_restore_request, + build_backup_instances_validate_for_backup_request, + build_backup_instances_validate_for_modify_backup_request, + build_backup_instances_validate_for_restore_request, + build_backup_policies_create_or_update_request, + build_backup_policies_delete_request, + build_backup_policies_get_request, + build_backup_policies_list_request, + build_backup_vault_operation_results_get_request, + build_backup_vaults_check_name_availability_request, + build_backup_vaults_create_or_update_request, + build_backup_vaults_delete_request, + build_backup_vaults_get_in_resource_group_request, + build_backup_vaults_get_in_subscription_request, + build_backup_vaults_get_request, + build_backup_vaults_update_request, + build_data_protection_check_feature_support_request, + build_data_protection_operations_list_request, + build_deleted_backup_instances_get_request, + build_deleted_backup_instances_list_request, + build_deleted_backup_instances_undelete_request, + build_dpp_resource_guard_proxy_create_or_update_request, + build_dpp_resource_guard_proxy_delete_request, + build_dpp_resource_guard_proxy_get_request, + build_dpp_resource_guard_proxy_list_request, + build_dpp_resource_guard_proxy_unlock_delete_request, + build_export_jobs_operation_result_get_request, + build_export_jobs_trigger_request, + build_fetch_cross_region_restore_job_get_request, + build_fetch_cross_region_restore_jobs_list_request, + build_fetch_secondary_recovery_points_list_request, + build_jobs_get_request, + build_jobs_list_request, + build_operation_result_get_request, + build_operation_status_backup_vault_context_get_request, + build_operation_status_get_request, + build_operation_status_resource_group_context_get_request, + build_recovery_points_get_request, + build_recovery_points_list_request, + build_resource_guards_delete_request, + build_resource_guards_get_backup_security_pin_requests_objects_request, + build_resource_guards_get_default_backup_security_pin_requests_object_request, + build_resource_guards_get_default_delete_protected_item_requests_object_request, + build_resource_guards_get_default_delete_resource_guard_proxy_requests_object_request, + build_resource_guards_get_default_disable_soft_delete_requests_object_request, + build_resource_guards_get_default_update_protected_item_requests_object_request, + build_resource_guards_get_default_update_protection_policy_requests_object_request, + build_resource_guards_get_delete_protected_item_requests_objects_request, + build_resource_guards_get_delete_resource_guard_proxy_requests_objects_request, + build_resource_guards_get_disable_soft_delete_requests_objects_request, + build_resource_guards_get_request, + build_resource_guards_get_resources_in_resource_group_request, + build_resource_guards_get_resources_in_subscription_request, + build_resource_guards_get_update_protected_item_requests_objects_request, + build_resource_guards_get_update_protection_policy_requests_objects_request, + build_resource_guards_patch_request, + build_resource_guards_put_request, + build_restorable_time_ranges_find_request, +) +from .._configuration import DataProtectionClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list + + +class DataProtectionOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`data_protection_operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_data_protection_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BackupInstancesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`backup_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_backup_instance_operation_result( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.BackupInstanceResource]: + """Get result of backup instance creation operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param operation_id: The name of the BackupInstanceResource. Required. + :type operation_id: str + :return: BackupInstanceResource or None. The BackupInstanceResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) + + _request = build_backup_instances_get_backup_instance_operation_result_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupInstanceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.BackupInstanceResource"]: + """Gets a backup instances belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of BackupInstanceResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupInstanceResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_instances_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupInstanceResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _validate_for_backup_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.ValidateForBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_for_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.ValidateForBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.ValidateForBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Is one of the following types: + ValidateForBackupRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_for_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> _models.BackupInstanceResource: + """Gets a backup instance with name in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :return: BackupInstanceResource. The BackupInstanceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) + + _request = build_backup_instances_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupInstanceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.BackupInstanceResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.BackupInstanceResource, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.BackupInstanceResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + BackupInstanceResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupInstanceResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BackupInstanceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BackupInstanceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_instances_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _adhoc_backup_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.TriggerBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_adhoc_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.TriggerBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.TriggerBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + TriggerBackupRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._adhoc_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _validate_for_modify_backup_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_for_modify_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.ValidateForModifyBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + ValidateForModifyBackupRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_for_modify_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _trigger_rehydrate_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRehydrationRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_trigger_rehydrate_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.AzureBackupRehydrationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRehydrationRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + AzureBackupRehydrationRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._trigger_rehydrate_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _trigger_restore_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRestoreRequest, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_trigger_restore_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.AzureBackupRestoreRequest, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRestoreRequest, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + AzureBackupRestoreRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest or JSON or + IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._trigger_restore_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _resume_backups_initial( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_instances_resume_backups_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_resume_backups( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will resume backups for backup instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_backups_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _resume_protection_initial( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_instances_resume_protection_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_resume_protection( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will resume protection for a stopped backup instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _stop_protection_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.StopProtectionRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_backup_instances_stop_protection_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[_models.StopProtectionRequest] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[JSON] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[IO[bytes]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.StopProtectionRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Is one of the following types: + StopProtectionRequest, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _suspend_backups_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.SuspendBackupRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_backup_instances_suspend_backups_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[_models.SuspendBackupRequest] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[JSON] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[IO[bytes]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.SuspendBackupRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Is one of the following types: + SuspendBackupRequest, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._suspend_backups_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _sync_backup_instance_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.SyncBackupInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_sync_backup_instance_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.SyncBackupInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.SyncBackupInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + SyncBackupInstanceRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._sync_backup_instance_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _validate_for_restore_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_for_restore_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.ValidateRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + ValidateRestoreRequestObject, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_for_restore_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _trigger_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_trigger_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Is one of the following types: + CrossRegionRestoreRequestObject, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._trigger_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _validate_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.ValidateCrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + ValidateCrossRegionRestoreRequestObject, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class BackupVaultOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`backup_vault_operation_results` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.BackupVaultResource]: + """Get a BackupVaultResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param operation_id: The name of the BackupVaultResource. Required. + :type operation_id: str + :return: BackupVaultResource or None. The BackupVaultResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) + + _request = build_backup_vault_operation_results_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class ResourceGuardsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`resource_guards` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_delete_resource_guard_proxy_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> _models.ResourceGuardResource: + """Returns a ResourceGuard belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: _models.ResourceGuardResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: Union[_models.ResourceGuardResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Is one of the following types: + ResourceGuardResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource or JSON or IO[bytes] + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_resource_guards_put_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: _models.PatchResourceGuardInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: Union[_models.PatchResourceGuardInput, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Is one of the following types: + PatchResourceGuardInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput or JSON or + IO[bytes] + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_resource_guards_patch_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any) -> None: + """Deletes a ResourceGuard resource from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resource_guards_delete_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_resources_in_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ResourceGuardResource"]: + """Returns ResourceGuards collection belonging to a ResourceGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ResourceGuardResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceGuardResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_resources_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceGuardResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def get_resources_in_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ResourceGuardResource"]: + """Returns ResourceGuards collection belonging to a subscription. + + :return: An iterator like instance of ResourceGuardResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceGuardResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_resources_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceGuardResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_disable_soft_delete_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_disable_soft_delete_requests_objects( + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_disable_soft_delete_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_update_protected_item_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_update_protected_item_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_update_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_update_protection_policy_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_update_protection_policy_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_delete_protected_item_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_delete_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_backup_security_pin_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_backup_security_pin_requests_objects( + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_backup_security_pin_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BackupVaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`backup_vaults` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.BackupVaultResource: + """Returns a resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :return: BackupVaultResource. The BackupVaultResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) + + _request = build_backup_vaults_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.BackupVaultResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_vaults_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.BackupVaultResource, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.BackupVaultResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Is one of the following types: + BackupVaultResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BackupVaultResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BackupVaultResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.PatchResourceRequestInput, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_vaults_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.PatchResourceRequestInput, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.PatchResourceRequestInput, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Is one of the following types: + PatchResourceRequestInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput or JSON or + IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of AsyncLROPoller that returns BackupVaultResource. The + BackupVaultResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BackupVaultResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BackupVaultResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_vaults_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a BackupVault resource from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_in_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.BackupVaultResource"]: + """Returns resource collection belonging to a subscription. + + :return: An iterator like instance of BackupVaultResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupVaultResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_vaults_get_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupVaultResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def get_in_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.BackupVaultResource"]: + """Returns resource collection belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of BackupVaultResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupVaultResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_vaults_get_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupVaultResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: _models.CheckNameAvailabilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CheckNameAvailabilityRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Is one of the following types: + CheckNameAvailabilityRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest or JSON or + IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_vaults_check_name_availability_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusBackupVaultContextOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`operation_status_backup_vault_context` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationResource: + """Gets the operation status for an operation over a BackupVault's context. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param operation_id: Required. + :type operation_id: str + :return: OperationResource. The OperationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) + + _request = build_operation_status_backup_vault_context_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExportJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`export_jobs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _trigger_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_export_jobs_trigger_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Triggers export of jobs and returns an OperationID to track. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._trigger_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ExportJobsOperationResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`export_jobs_operation_result` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.ExportJobsResult]: + """Gets the operation result of operation triggered by Export Jobs API. If the operation is + successful, then it also contains URL of a Blob and a SAS key to access the same. The blob + contains exported jobs in JSON serialized format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param operation_id: OperationID which represents the export job. Required. + :type operation_id: str + :return: ExportJobsResult or None. The ExportJobsResult is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) + + _request = build_export_jobs_operation_result_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExportJobsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BackupPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`backup_policies` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Gets a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) + + _request = build_backup_policies_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BaseBackupPolicyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: _models.BaseBackupPolicyResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: Union[_models.BaseBackupPolicyResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Is one of the following types: + BaseBackupPolicyResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource or JSON or + IO[bytes] + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_policies_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BaseBackupPolicyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any) -> None: + """Deletes a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_backup_policies_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.BaseBackupPolicyResource"]: + """Returns list of backup policies belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of BaseBackupPolicyResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BaseBackupPolicyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_policies_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BaseBackupPolicyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RestorableTimeRangesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`restorable_time_ranges` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.AzureBackupFindRestorableTimeRangesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupFindRestorableTimeRangesRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + AzureBackupFindRestorableTimeRangesRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest + or JSON or IO[bytes] + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restorable_time_ranges_find_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupFindRestorableTimeRangesResponseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`recovery_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + recovery_point_id: str, + **kwargs: Any + ) -> _models.AzureBackupRecoveryPointResource: + """Gets a Recovery Point using recoveryPointId for a Datasource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param recovery_point_id: Required. + :type recovery_point_id: str + :return: AzureBackupRecoveryPointResource. The AzureBackupRecoveryPointResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) + + _request = build_recovery_points_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupRecoveryPointResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Recovery Points for a DataSource in a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureBackupRecoveryPointResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_recovery_points_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupRecoveryPointResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`jobs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Gets a job with id in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). Required. + :type job_id: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) + + _request = build_jobs_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupJobResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupJobResource"]: + """Returns list of jobs belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureBackupJobResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_jobs_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupJobResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DeletedBackupInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`deleted_backup_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> _models.DeletedBackupInstanceResource: + """Gets a deleted backup instance with name in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the deleted backup instance. Required. + :type backup_instance_name: str + :return: DeletedBackupInstanceResource. The DeletedBackupInstanceResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) + + _request = build_deleted_backup_instances_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedBackupInstanceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DeletedBackupInstanceResource"]: + """Gets deleted backup instances belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of DeletedBackupInstanceResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedBackupInstanceResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_deleted_backup_instances_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedBackupInstanceResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _undelete_initial( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deleted_backup_instances_undelete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_undelete( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """A long-running resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the deleted backup instance. Required. + :type backup_instance_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._undelete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DppResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`dpp_resource_guard_proxy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + _request = build_dpp_resource_guard_proxy_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardProxyBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is one of the following types: + ResourceGuardProxyBaseResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or JSON or + IO[bytes] + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dpp_resource_guard_proxy_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardProxyBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> None: + """Deletes the ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dpp_resource_guard_proxy_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ResourceGuardProxyBaseResource"]: + """Returns the list of ResourceGuardProxies associated with the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of ResourceGuardProxyBaseResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceGuardProxyBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_dpp_resource_guard_proxy_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceGuardProxyBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is one of the following types: + UnlockDeleteRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dpp_resource_guard_proxy_unlock_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.UnlockDeleteResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`operation_result` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_models.OperationJobExtendedInfo]: + """Gets the operation status for a resource. + + Gets the operation result for a resource. + + :param operation_id: Required. + :type operation_id: str + :param location: The name of the Azure region. Required. + :type location: str + :return: OperationJobExtendedInfo or None. The OperationJobExtendedInfo is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + + _request = build_operation_result_get_request( + operation_id=operation_id, + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`operation_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: + """Gets the operation status for a resource. + + Gets the operation status for a resource. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: Required. + :type operation_id: str + :return: OperationResource. The OperationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) + + _request = build_operation_status_get_request( + location=location, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusResourceGroupContextOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`operation_status_resource_group_context` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: + """Gets the operation status for an operation over a ResourceGroup's context. + + Gets the operation status for an operation over a ResourceGroup's context. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param operation_id: Required. + :type operation_id: str + :return: OperationResource. The OperationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) + + _request = build_operation_status_resource_group_context_get_request( + resource_group_name=resource_group_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DataProtectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`data_protection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def check_feature_support( + self, + location: str, + parameters: _models.FeatureValidationRequestBase, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_feature_support( + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_feature_support( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_feature_support( + self, location: str, parameters: Union[_models.FeatureValidationRequestBase, JSON, IO[bytes]], **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Is one of the following types: + FeatureValidationRequestBase, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase or JSON or + IO[bytes] + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FeatureValidationResponseBase] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_protection_check_feature_support_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FeatureValidationResponseBase, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FetchSecondaryRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`fetch_secondary_recovery_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: _models.FetchSecondaryRPsRequestParameters, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype 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 + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype 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 + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype 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 + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.FetchSecondaryRPsRequestParameters, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + FetchSecondaryRPsRequestParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters or JSON + or IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AzureBackupRecoveryPointResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_fetch_secondary_recovery_points_list_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupRecoveryPointResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FetchCrossRegionRestoreJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`fetch_cross_region_restore_job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def get( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + CrossRegionRestoreJobRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest or JSON or + IO[bytes] + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fetch_cross_region_restore_job_get_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupJobResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FetchCrossRegionRestoreJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`fetch_cross_region_restore_jobs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobsRequest, + *, + filter: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + filter: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + filter: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobsRequest, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + CrossRegionRestoreJobsRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest or JSON or + IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AzureBackupJobResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_fetch_cross_region_restore_jobs_list_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + filter=filter, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupJobResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BackupInstancesExtensionRoutingOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s + :attr:`backup_instances_extension_routing` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_id: str, **kwargs: Any) -> AsyncItemPaged["_models.BackupInstanceResource"]: + """Gets a list of backup instances associated with a tracked resource. + + :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. + Required. + :type resource_id: str + :return: An iterator like instance of BackupInstanceResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupInstanceResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_instances_extension_routing_list_request( + resource_id=resource_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupInstanceResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py deleted file mode 100644 index ab9952362e82..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py +++ /dev/null @@ -1,230 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._recovery_points_operations import build_get_request, build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`recovery_points` 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, - backup_instance_name: str, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Recovery Points for a DataSource in a vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - recovery_point_id: str, - **kwargs: Any - ) -> _models.AzureBackupRecoveryPointResource: - """Gets a Recovery Point using recoveryPointId for a Datasource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param recovery_point_id: Required. - :type recovery_point_id: str - :return: AzureBackupRecoveryPointResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - recovery_point_id=recovery_point_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupRecoveryPointResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py deleted file mode 100644 index 9f5e35c1beff..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py +++ /dev/null @@ -1,1575 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._resource_guards_operations import ( - build_delete_request, - build_get_backup_security_pin_requests_objects_request, - build_get_default_backup_security_pin_requests_object_request, - build_get_default_delete_protected_item_requests_object_request, - build_get_default_delete_resource_guard_proxy_requests_object_request, - build_get_default_disable_soft_delete_requests_object_request, - build_get_default_update_protected_item_requests_object_request, - build_get_default_update_protection_policy_requests_object_request, - build_get_delete_protected_item_requests_objects_request, - build_get_delete_resource_guard_proxy_requests_objects_request, - build_get_disable_soft_delete_requests_objects_request, - build_get_request, - build_get_resources_in_resource_group_request, - build_get_resources_in_subscription_request, - build_get_update_protected_item_requests_objects_request, - build_get_update_protection_policy_requests_objects_request, - build_patch_request, - build_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ResourceGuardsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`resource_guards` 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 get_resources_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ResourceGuardResource"]: - """Returns ResourceGuards collection belonging to a subscription. - - Returns ResourceGuards collection belonging to a subscription. - - :return: An iterator like instance of either ResourceGuardResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_resources_in_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_resources_in_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ResourceGuardResource"]: - """Returns ResourceGuards collection belonging to a ResourceGroup. - - Returns ResourceGuards collection belonging to a ResourceGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ResourceGuardResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_resources_in_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def put( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: _models.ResourceGuardResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Creates or updates a ResourceGuard resource belonging to a resource group. - - Creates or updates a ResourceGuard resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Creates or updates a ResourceGuard resource belonging to a resource group. - - Creates or updates a ResourceGuard resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: Union[_models.ResourceGuardResource, IO[bytes]], - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Creates or updates a ResourceGuard resource belonging to a resource group. - - Creates or updates a ResourceGuard resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Is either a ResourceGuardResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource or IO[bytes] - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ResourceGuardResource") - - _request = build_put_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> _models.ResourceGuardResource: - """Returns a ResourceGuard belonging to a resource group. - - Returns a ResourceGuard belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> None: - """Deletes a ResourceGuard resource from the resource group. - - Deletes a ResourceGuard resource from the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def patch( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: _models.PatchResourceGuardInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def patch( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def patch( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: Union[_models.PatchResourceGuardInput, IO[bytes]], - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Is either a PatchResourceGuardInput type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput or IO[bytes] - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PatchResourceGuardInput") - - _request = build_patch_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_disable_soft_delete_requests_objects( - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_disable_soft_delete_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_delete_resource_guard_proxy_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_backup_security_pin_requests_objects( - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_backup_security_pin_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_delete_protected_item_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_update_protection_policy_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def get_update_protected_item_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_update_protected_item_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_disable_soft_delete_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_delete_resource_guard_proxy_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_backup_security_pin_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_delete_protected_item_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_update_protection_policy_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_update_protected_item_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py deleted file mode 100644 index 61d903d7b54e..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py +++ /dev/null @@ -1,199 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, 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 -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._restorable_time_ranges_operations import build_find_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RestorableTimeRangesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionMgmtClient`'s - :attr:`restorable_time_ranges` 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") - - @overload - async def find( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.AzureBackupFindRestorableTimeRangesRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: - """find. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupFindRestorableTimeRangesResponseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def find( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: - """find. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupFindRestorableTimeRangesResponseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def find( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupFindRestorableTimeRangesRequest, IO[bytes]], - **kwargs: Any - ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: - """find. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a - AzureBackupFindRestorableTimeRangesRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - or IO[bytes] - :return: AzureBackupFindRestorableTimeRangesResponseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AzureBackupFindRestorableTimeRangesRequest") - - _request = build_find_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupFindRestorableTimeRangesResponseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py index 52f37de6ee55..e0326280a61b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py @@ -2,215 +2,216 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AbsoluteDeleteOption -from ._models_py3 import AdHocBackupRuleOptions -from ._models_py3 import AdhocBackupTriggerOption -from ._models_py3 import AdhocBasedTaggingCriteria -from ._models_py3 import AdhocBasedTriggerContext -from ._models_py3 import AuthCredentials -from ._models_py3 import AzureBackupDiscreteRecoveryPoint -from ._models_py3 import AzureBackupFindRestorableTimeRangesRequest -from ._models_py3 import AzureBackupFindRestorableTimeRangesRequestResource -from ._models_py3 import AzureBackupFindRestorableTimeRangesResponse -from ._models_py3 import AzureBackupFindRestorableTimeRangesResponseResource -from ._models_py3 import AzureBackupJob -from ._models_py3 import AzureBackupJobResource -from ._models_py3 import AzureBackupJobResourceList -from ._models_py3 import AzureBackupParams -from ._models_py3 import AzureBackupRecoveryPoint -from ._models_py3 import AzureBackupRecoveryPointBasedRestoreRequest -from ._models_py3 import AzureBackupRecoveryPointResource -from ._models_py3 import AzureBackupRecoveryPointResourceList -from ._models_py3 import AzureBackupRecoveryTimeBasedRestoreRequest -from ._models_py3 import AzureBackupRehydrationRequest -from ._models_py3 import AzureBackupRestoreRequest -from ._models_py3 import AzureBackupRestoreWithRehydrationRequest -from ._models_py3 import AzureBackupRule -from ._models_py3 import AzureMonitorAlertSettings -from ._models_py3 import AzureOperationalStoreParameters -from ._models_py3 import AzureRetentionRule -from ._models_py3 import BackupCriteria -from ._models_py3 import BackupDatasourceParameters -from ._models_py3 import BackupInstance -from ._models_py3 import BackupInstanceResource -from ._models_py3 import BackupInstanceResourceList -from ._models_py3 import BackupParameters -from ._models_py3 import BackupPolicy -from ._models_py3 import BackupSchedule -from ._models_py3 import BackupVault -from ._models_py3 import BackupVaultResource -from ._models_py3 import BackupVaultResourceList -from ._models_py3 import BaseBackupPolicy -from ._models_py3 import BaseBackupPolicyResource -from ._models_py3 import BaseBackupPolicyResourceList -from ._models_py3 import BasePolicyRule -from ._models_py3 import BaseResourceProperties -from ._models_py3 import BlobBackupDatasourceParameters -from ._models_py3 import CheckNameAvailabilityRequest -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import ClientDiscoveryDisplay -from ._models_py3 import ClientDiscoveryForLogSpecification -from ._models_py3 import ClientDiscoveryForProperties -from ._models_py3 import ClientDiscoveryForServiceSpecification -from ._models_py3 import ClientDiscoveryResponse -from ._models_py3 import ClientDiscoveryValueForSingleApi -from ._models_py3 import CmkKekIdentity -from ._models_py3 import CmkKeyVaultProperties -from ._models_py3 import CopyOnExpiryOption -from ._models_py3 import CopyOption -from ._models_py3 import CrossRegionRestoreDetails -from ._models_py3 import CrossRegionRestoreJobRequest -from ._models_py3 import CrossRegionRestoreJobsRequest -from ._models_py3 import CrossRegionRestoreRequestObject -from ._models_py3 import CrossRegionRestoreSettings -from ._models_py3 import CrossSubscriptionRestoreSettings -from ._models_py3 import CustomCopyOption -from ._models_py3 import DataStoreInfoBase -from ._models_py3 import DataStoreParameters -from ._models_py3 import Datasource -from ._models_py3 import DatasourceSet -from ._models_py3 import Day -from ._models_py3 import DefaultResourceProperties -from ._models_py3 import DeleteOption -from ._models_py3 import DeletedBackupInstance -from ._models_py3 import DeletedBackupInstanceResource -from ._models_py3 import DeletedBackupInstanceResourceList -from ._models_py3 import DeletionInfo -from ._models_py3 import DppBaseResource -from ._models_py3 import DppBaseResourceList -from ._models_py3 import DppBaseTrackedResource -from ._models_py3 import DppIdentityDetails -from ._models_py3 import DppProxyResource -from ._models_py3 import DppResource -from ._models_py3 import DppResourceList -from ._models_py3 import DppTrackedResource -from ._models_py3 import DppTrackedResourceList -from ._models_py3 import DppWorkerRequest -from ._models_py3 import EncryptionSettings -from ._models_py3 import Error -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ExportJobsResult -from ._models_py3 import FeatureSettings -from ._models_py3 import FeatureValidationRequest -from ._models_py3 import FeatureValidationRequestBase -from ._models_py3 import FeatureValidationResponse -from ._models_py3 import FeatureValidationResponseBase -from ._models_py3 import FetchSecondaryRPsRequestParameters -from ._models_py3 import IdentityDetails -from ._models_py3 import ImmediateCopyOption -from ._models_py3 import ImmutabilitySettings -from ._models_py3 import InnerError -from ._models_py3 import ItemLevelRestoreCriteria -from ._models_py3 import ItemLevelRestoreTargetInfo -from ._models_py3 import ItemPathBasedRestoreCriteria -from ._models_py3 import JobExtendedInfo -from ._models_py3 import JobSubTask -from ._models_py3 import KubernetesClusterBackupDatasourceParameters -from ._models_py3 import KubernetesClusterRestoreCriteria -from ._models_py3 import KubernetesClusterVaultTierRestoreCriteria -from ._models_py3 import KubernetesPVRestoreCriteria -from ._models_py3 import KubernetesStorageClassRestoreCriteria -from ._models_py3 import MonitoringSettings -from ._models_py3 import NamespacedNameResource -from ._models_py3 import OperationExtendedInfo -from ._models_py3 import OperationJobExtendedInfo -from ._models_py3 import OperationResource -from ._models_py3 import PatchBackupVaultInput -from ._models_py3 import PatchResourceGuardInput -from ._models_py3 import PatchResourceRequestInput -from ._models_py3 import PolicyInfo -from ._models_py3 import PolicyParameters -from ._models_py3 import ProtectionStatusDetails -from ._models_py3 import RangeBasedItemLevelRestoreCriteria -from ._models_py3 import RecoveryPointDataStoreDetails -from ._models_py3 import RecoveryPointsFilters -from ._models_py3 import ResourceGuard -from ._models_py3 import ResourceGuardOperation -from ._models_py3 import ResourceGuardOperationDetail -from ._models_py3 import ResourceGuardProxyBase -from ._models_py3 import ResourceGuardProxyBaseResource -from ._models_py3 import ResourceGuardProxyBaseResourceList -from ._models_py3 import ResourceGuardResource -from ._models_py3 import ResourceGuardResourceList -from ._models_py3 import ResourceMoveDetails -from ._models_py3 import RestorableTimeRange -from ._models_py3 import RestoreFilesTargetInfo -from ._models_py3 import RestoreJobRecoveryPointDetails -from ._models_py3 import RestoreTargetInfo -from ._models_py3 import RestoreTargetInfoBase -from ._models_py3 import RetentionTag -from ._models_py3 import ScheduleBasedBackupCriteria -from ._models_py3 import ScheduleBasedTriggerContext -from ._models_py3 import SecretStoreBasedAuthCredentials -from ._models_py3 import SecretStoreResource -from ._models_py3 import SecuritySettings -from ._models_py3 import SoftDeleteSettings -from ._models_py3 import SourceLifeCycle -from ._models_py3 import StopProtectionRequest -from ._models_py3 import StorageSetting -from ._models_py3 import SupportedFeature -from ._models_py3 import SuspendBackupRequest -from ._models_py3 import SyncBackupInstanceRequest -from ._models_py3 import SystemData -from ._models_py3 import TaggingCriteria -from ._models_py3 import TargetCopySetting -from ._models_py3 import TargetDetails -from ._models_py3 import TriggerBackupRequest -from ._models_py3 import TriggerContext -from ._models_py3 import UnlockDeleteRequest -from ._models_py3 import UnlockDeleteResponse -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import UserFacingError -from ._models_py3 import UserFacingWarningDetail -from ._models_py3 import ValidateCrossRegionRestoreRequestObject -from ._models_py3 import ValidateForBackupRequest -from ._models_py3 import ValidateRestoreRequestObject +from typing import TYPE_CHECKING -from ._data_protection_mgmt_client_enums import AbsoluteMarker -from ._data_protection_mgmt_client_enums import AlertsState -from ._data_protection_mgmt_client_enums import BCDRSecurityLevel -from ._data_protection_mgmt_client_enums import CreatedByType -from ._data_protection_mgmt_client_enums import CrossRegionRestoreState -from ._data_protection_mgmt_client_enums import CrossSubscriptionRestoreState -from ._data_protection_mgmt_client_enums import CurrentProtectionState -from ._data_protection_mgmt_client_enums import DataStoreTypes -from ._data_protection_mgmt_client_enums import DayOfWeek -from ._data_protection_mgmt_client_enums import EncryptionState -from ._data_protection_mgmt_client_enums import ExistingResourcePolicy -from ._data_protection_mgmt_client_enums import FeatureSupportStatus -from ._data_protection_mgmt_client_enums import FeatureType -from ._data_protection_mgmt_client_enums import IdentityType -from ._data_protection_mgmt_client_enums import ImmutabilityState -from ._data_protection_mgmt_client_enums import InfrastructureEncryptionState -from ._data_protection_mgmt_client_enums import Month -from ._data_protection_mgmt_client_enums import PersistentVolumeRestoreMode -from ._data_protection_mgmt_client_enums import ProvisioningState -from ._data_protection_mgmt_client_enums import RecoveryOption -from ._data_protection_mgmt_client_enums import RecoveryPointCompletionState -from ._data_protection_mgmt_client_enums import RehydrationPriority -from ._data_protection_mgmt_client_enums import RehydrationStatus -from ._data_protection_mgmt_client_enums import ResourceMoveState -from ._data_protection_mgmt_client_enums import ResourcePropertiesObjectType -from ._data_protection_mgmt_client_enums import RestoreSourceDataStoreType -from ._data_protection_mgmt_client_enums import RestoreTargetLocationType -from ._data_protection_mgmt_client_enums import SecretStoreType -from ._data_protection_mgmt_client_enums import SecureScoreLevel -from ._data_protection_mgmt_client_enums import SoftDeleteState -from ._data_protection_mgmt_client_enums import SourceDataStoreType -from ._data_protection_mgmt_client_enums import Status -from ._data_protection_mgmt_client_enums import StorageSettingStoreTypes -from ._data_protection_mgmt_client_enums import StorageSettingTypes -from ._data_protection_mgmt_client_enums import SyncType -from ._data_protection_mgmt_client_enums import ValidationType -from ._data_protection_mgmt_client_enums import WeekNumber +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AbsoluteDeleteOption, + AdHocBackupRuleOptions, + AdhocBackupTriggerOption, + AdhocBasedTaggingCriteria, + AdhocBasedTriggerContext, + AdlsBlobBackupDatasourceParameters, + AuthCredentials, + AzureBackupDiscreteRecoveryPoint, + AzureBackupFindRestorableTimeRangesRequest, + AzureBackupFindRestorableTimeRangesResponse, + AzureBackupFindRestorableTimeRangesResponseResource, + AzureBackupJob, + AzureBackupJobResource, + AzureBackupParams, + AzureBackupRecoveryPoint, + AzureBackupRecoveryPointBasedRestoreRequest, + AzureBackupRecoveryPointResource, + AzureBackupRecoveryTimeBasedRestoreRequest, + AzureBackupRehydrationRequest, + AzureBackupRestoreRequest, + AzureBackupRestoreWithRehydrationRequest, + AzureBackupRule, + AzureMonitorAlertSettings, + AzureOperationalStoreParameters, + AzureRetentionRule, + BackupCriteria, + BackupDatasourceParameters, + BackupInstance, + BackupInstanceResource, + BackupParameters, + BackupPolicy, + BackupSchedule, + BackupVault, + BackupVaultResource, + BaseBackupPolicy, + BaseBackupPolicyResource, + BasePolicyRule, + BaseResourceProperties, + BlobBackupDatasourceParameters, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResult, + CloudError, + CmkKekIdentity, + CmkKeyVaultProperties, + CopyOnExpiryOption, + CopyOption, + CrossRegionRestoreDetails, + CrossRegionRestoreJobRequest, + CrossRegionRestoreJobsRequest, + CrossRegionRestoreRequestObject, + CrossRegionRestoreSettings, + CrossSubscriptionRestoreSettings, + CustomCopyOption, + DataStoreInfoBase, + DataStoreParameters, + Datasource, + DatasourceSet, + Day, + DefaultResourceProperties, + DeleteOption, + DeletedBackupInstance, + DeletedBackupInstanceResource, + DeletionInfo, + DppBaseResource, + DppIdentityDetails, + DppResource, + DppResourceList, + DppTrackedResourceList, + EncryptionSettings, + Error, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ExportJobsResult, + FeatureSettings, + FeatureValidationRequest, + FeatureValidationRequestBase, + FeatureValidationResponse, + FeatureValidationResponseBase, + FetchSecondaryRPsRequestParameters, + IdentityDetails, + ImmediateCopyOption, + ImmutabilitySettings, + InnerError, + ItemLevelRestoreCriteria, + ItemLevelRestoreTargetInfo, + ItemPathBasedRestoreCriteria, + JobExtendedInfo, + JobSubTask, + KubernetesClusterBackupDatasourceParameters, + KubernetesClusterRestoreCriteria, + KubernetesClusterVaultTierRestoreCriteria, + KubernetesPVRestoreCriteria, + KubernetesStorageClassRestoreCriteria, + MonitoringSettings, + NamespacedNameResource, + Operation, + OperationDisplay, + OperationExtendedInfo, + OperationJobExtendedInfo, + OperationResource, + PatchBackupVaultInput, + PatchResourceGuardInput, + PatchResourceRequestInput, + PolicyInfo, + PolicyParameters, + ProtectionStatusDetails, + ProxyResource, + RangeBasedItemLevelRestoreCriteria, + RecoveryPointDataStoreDetails, + Resource, + ResourceGuard, + ResourceGuardOperation, + ResourceGuardOperationDetail, + ResourceGuardProxyBase, + ResourceGuardProxyBaseResource, + ResourceGuardResource, + ResourceMoveDetails, + RestorableTimeRange, + RestoreFilesTargetInfo, + RestoreJobRecoveryPointDetails, + RestoreTargetInfo, + RestoreTargetInfoBase, + RetentionTag, + ScheduleBasedBackupCriteria, + ScheduleBasedTriggerContext, + SecretStoreBasedAuthCredentials, + SecretStoreResource, + SecuritySettings, + SoftDeleteSettings, + SourceLifeCycle, + StopProtectionRequest, + StorageSetting, + SupportedFeature, + SuspendBackupRequest, + SyncBackupInstanceRequest, + SystemData, + TaggingCriteria, + TargetCopySetting, + TargetDetails, + TrackedResource, + TriggerBackupRequest, + TriggerContext, + UnlockDeleteRequest, + UnlockDeleteResponse, + UserAssignedIdentity, + UserFacingError, + UserFacingWarningDetail, + ValidateCrossRegionRestoreRequestObject, + ValidateForBackupRequest, + ValidateForModifyBackupRequest, + ValidateRestoreRequestObject, +) + +from ._enums import ( # type: ignore + AKSVolumeTypes, + AbsoluteMarker, + ActionType, + AlertsState, + BCDRSecurityLevel, + CreatedByType, + CrossRegionRestoreState, + CrossSubscriptionRestoreState, + CurrentProtectionState, + DataStoreTypes, + DayOfWeek, + EncryptionState, + ExistingResourcePolicy, + FeatureSupportStatus, + FeatureType, + IdentityType, + ImmutabilityState, + InfrastructureEncryptionState, + Month, + Origin, + PersistentVolumeRestoreMode, + ProvisioningState, + RecoveryOption, + RecoveryPointCompletionState, + RehydrationPriority, + RehydrationStatus, + ResourceMoveState, + ResourcePropertiesObjectType, + RestoreSourceDataStoreType, + RestoreTargetLocationType, + SecretStoreType, + SecureScoreLevel, + SoftDeleteState, + SourceDataStoreType, + Status, + StorageSettingStoreTypes, + StorageSettingTypes, + SyncType, + ValidationType, + WeekNumber, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -219,20 +220,18 @@ "AdhocBackupTriggerOption", "AdhocBasedTaggingCriteria", "AdhocBasedTriggerContext", + "AdlsBlobBackupDatasourceParameters", "AuthCredentials", "AzureBackupDiscreteRecoveryPoint", "AzureBackupFindRestorableTimeRangesRequest", - "AzureBackupFindRestorableTimeRangesRequestResource", "AzureBackupFindRestorableTimeRangesResponse", "AzureBackupFindRestorableTimeRangesResponseResource", "AzureBackupJob", "AzureBackupJobResource", - "AzureBackupJobResourceList", "AzureBackupParams", "AzureBackupRecoveryPoint", "AzureBackupRecoveryPointBasedRestoreRequest", "AzureBackupRecoveryPointResource", - "AzureBackupRecoveryPointResourceList", "AzureBackupRecoveryTimeBasedRestoreRequest", "AzureBackupRehydrationRequest", "AzureBackupRestoreRequest", @@ -245,27 +244,19 @@ "BackupDatasourceParameters", "BackupInstance", "BackupInstanceResource", - "BackupInstanceResourceList", "BackupParameters", "BackupPolicy", "BackupSchedule", "BackupVault", "BackupVaultResource", - "BackupVaultResourceList", "BaseBackupPolicy", "BaseBackupPolicyResource", - "BaseBackupPolicyResourceList", "BasePolicyRule", "BaseResourceProperties", "BlobBackupDatasourceParameters", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResult", - "ClientDiscoveryDisplay", - "ClientDiscoveryForLogSpecification", - "ClientDiscoveryForProperties", - "ClientDiscoveryForServiceSpecification", - "ClientDiscoveryResponse", - "ClientDiscoveryValueForSingleApi", + "CloudError", "CmkKekIdentity", "CmkKeyVaultProperties", "CopyOnExpiryOption", @@ -286,18 +277,12 @@ "DeleteOption", "DeletedBackupInstance", "DeletedBackupInstanceResource", - "DeletedBackupInstanceResourceList", "DeletionInfo", "DppBaseResource", - "DppBaseResourceList", - "DppBaseTrackedResource", "DppIdentityDetails", - "DppProxyResource", "DppResource", "DppResourceList", - "DppTrackedResource", "DppTrackedResourceList", - "DppWorkerRequest", "EncryptionSettings", "Error", "ErrorAdditionalInfo", @@ -326,6 +311,8 @@ "KubernetesStorageClassRestoreCriteria", "MonitoringSettings", "NamespacedNameResource", + "Operation", + "OperationDisplay", "OperationExtendedInfo", "OperationJobExtendedInfo", "OperationResource", @@ -335,17 +322,16 @@ "PolicyInfo", "PolicyParameters", "ProtectionStatusDetails", + "ProxyResource", "RangeBasedItemLevelRestoreCriteria", "RecoveryPointDataStoreDetails", - "RecoveryPointsFilters", + "Resource", "ResourceGuard", "ResourceGuardOperation", "ResourceGuardOperationDetail", "ResourceGuardProxyBase", "ResourceGuardProxyBaseResource", - "ResourceGuardProxyBaseResourceList", "ResourceGuardResource", - "ResourceGuardResourceList", "ResourceMoveDetails", "RestorableTimeRange", "RestoreFilesTargetInfo", @@ -369,6 +355,7 @@ "TaggingCriteria", "TargetCopySetting", "TargetDetails", + "TrackedResource", "TriggerBackupRequest", "TriggerContext", "UnlockDeleteRequest", @@ -378,8 +365,11 @@ "UserFacingWarningDetail", "ValidateCrossRegionRestoreRequestObject", "ValidateForBackupRequest", + "ValidateForModifyBackupRequest", "ValidateRestoreRequestObject", + "AKSVolumeTypes", "AbsoluteMarker", + "ActionType", "AlertsState", "BCDRSecurityLevel", "CreatedByType", @@ -396,6 +386,7 @@ "ImmutabilityState", "InfrastructureEncryptionState", "Month", + "Origin", "PersistentVolumeRestoreMode", "ProvisioningState", "RecoveryOption", @@ -417,5 +408,5 @@ "ValidationType", "WeekNumber", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_enums.py similarity index 88% rename from sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py rename to sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_enums.py index 4cb5779c5255..97305d69da97 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_mgmt_client_enums.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -11,7 +11,7 @@ class AbsoluteMarker(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AbsoluteMarker.""" + """Type of AbsoluteMarker.""" ALL_BACKUP = "AllBackup" FIRST_OF_DAY = "FirstOfDay" @@ -20,8 +20,24 @@ class AbsoluteMarker(str, Enum, metaclass=CaseInsensitiveEnumMeta): FIRST_OF_YEAR = "FirstOfYear" +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ + + INTERNAL = "Internal" + """Actions are for internal-only APIs.""" + + +class AKSVolumeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of AKSVolumeTypes.""" + + AZURE_DISK = "AzureDisk" + AZURE_FILE_SHARE_SMB = "AzureFileShareSMB" + + class AlertsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AlertsState.""" + """Type of AlertsState.""" ENABLED = "Enabled" DISABLED = "Disabled" @@ -38,12 +54,16 @@ class BCDRSecurityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class CrossRegionRestoreState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -87,7 +107,7 @@ class DataStoreTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """DayOfWeek.""" + """Type of DayOfWeek.""" FRIDAY = "Friday" MONDAY = "Monday" @@ -163,7 +183,7 @@ class InfrastructureEncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta class Month(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Month.""" + """Type of Month.""" APRIL = "April" AUGUST = "August" @@ -179,6 +199,19 @@ class Month(str, Enum, metaclass=CaseInsensitiveEnumMeta): SEPTEMBER = "September" +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + """Indicates the operation is initiated by a user.""" + SYSTEM = "system" + """Indicates the operation is initiated by a system.""" + USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + class PersistentVolumeRestoreMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether volumes needs to be restored. @@ -222,7 +255,7 @@ class RehydrationPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RehydrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RehydrationStatus.""" + """Type of RehydrationStatus.""" CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS" COMPLETED = "COMPLETED" @@ -352,7 +385,7 @@ class ValidationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class WeekNumber(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """WeekNumber.""" + """Type of WeekNumber.""" FIRST = "First" FOURTH = "Fourth" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py new file mode 100644 index 000000000000..2d4151625c9d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models.py @@ -0,0 +1,6818 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field +from ._enums import ResourcePropertiesObjectType + +if TYPE_CHECKING: + from .. import models as _models + + +class DeleteOption(_Model): + """Delete Option. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AbsoluteDeleteOption + + :ivar duration: Duration of deletion after given timespan. Required. + :vartype duration: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + duration: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Duration of deletion after given timespan. Required.""" + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + duration: str, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AbsoluteDeleteOption(DeleteOption, discriminator="AbsoluteDeleteOption"): + """Delete option with duration. + + :ivar duration: Duration of deletion after given timespan. Required. + :vartype duration: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "AbsoluteDeleteOption". + :vartype object_type: str + """ + + object_type: Literal["AbsoluteDeleteOption"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"AbsoluteDeleteOption\".""" + + @overload + def __init__( + self, + *, + duration: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AbsoluteDeleteOption" # type: ignore + + +class AdHocBackupRuleOptions(_Model): + """Adhoc backup rules. + + :ivar rule_name: Required. + :vartype rule_name: str + :ivar trigger_option: Adhoc backup trigger option. Required. + :vartype trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption + """ + + rule_name: str = rest_field(name="ruleName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + trigger_option: "_models.AdhocBackupTriggerOption" = rest_field( + name="triggerOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Adhoc backup trigger option. Required.""" + + @overload + def __init__( + self, + *, + rule_name: str, + trigger_option: "_models.AdhocBackupTriggerOption", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdhocBackupTriggerOption(_Model): + """Adhoc backup trigger option. + + :ivar retention_tag_override: + :vartype retention_tag_override: str + """ + + retention_tag_override: Optional[str] = rest_field( + name="retentionTagOverride", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + retention_tag_override: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdhocBasedTaggingCriteria(_Model): + """Adhoc backup tagging criteria. + + :ivar tag_info: Retention tag information. + :vartype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag + """ + + tag_info: Optional["_models.RetentionTag"] = rest_field( + name="tagInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention tag information.""" + + @overload + def __init__( + self, + *, + tag_info: Optional["_models.RetentionTag"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TriggerContext(_Model): + """Trigger context. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AdhocBasedTriggerContext, ScheduleBasedTriggerContext + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdhocBasedTriggerContext(TriggerContext, discriminator="AdhocBasedTriggerContext"): + """Adhoc trigger context. + + :ivar tagging_criteria: Tagging Criteria containing retention tag for adhoc backup. Required. + :vartype tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "AdhocBasedTriggerContext". + :vartype object_type: str + """ + + tagging_criteria: "_models.AdhocBasedTaggingCriteria" = rest_field( + name="taggingCriteria", visibility=["read", "create", "update", "delete", "query"] + ) + """Tagging Criteria containing retention tag for adhoc backup. Required.""" + object_type: Literal["AdhocBasedTriggerContext"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"AdhocBasedTriggerContext\".""" + + @overload + def __init__( + self, + *, + tagging_criteria: "_models.AdhocBasedTaggingCriteria", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AdhocBasedTriggerContext" # type: ignore + + +class BackupDatasourceParameters(_Model): + """Parameters for Backup Datasource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AdlsBlobBackupDatasourceParameters, BlobBackupDatasourceParameters, + KubernetesClusterBackupDatasourceParameters + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BlobBackupDatasourceParameters(BackupDatasourceParameters, discriminator="BlobBackupDatasourceParameters"): + """Parameters to be used during configuration of backup of blobs. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AdlsBlobBackupDatasourceParameters + + :ivar containers_list: List of containers to be backed up during configuration of backup of + blobs. Required. + :vartype containers_list: list[str] + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "BlobBackupDatasourceParameters". + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + containers_list: list[str] = rest_field( + name="containersList", visibility=["read", "create", "update", "delete", "query"] + ) + """List of containers to be backed up during configuration of backup of blobs. Required.""" + object_type: Literal["BlobBackupDatasourceParameters"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"BlobBackupDatasourceParameters\".""" + + @overload + def __init__( + self, + *, + containers_list: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "BlobBackupDatasourceParameters" # type: ignore + + +class AdlsBlobBackupDatasourceParameters( + BlobBackupDatasourceParameters, discriminator="AdlsBlobBackupDatasourceParameters" +): + """Parameters to be used during configuration of backup of azure data lake storage account blobs. + + :ivar containers_list: List of containers to be backed up during configuration of backup of + blobs. Required. + :vartype containers_list: list[str] + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "AdlsBlobBackupDatasourceParameters". + :vartype object_type: str + """ + + object_type: Literal["AdlsBlobBackupDatasourceParameters"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"AdlsBlobBackupDatasourceParameters\".""" + + @overload + def __init__( + self, + *, + containers_list: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AdlsBlobBackupDatasourceParameters" # type: ignore + + +class AuthCredentials(_Model): + """Base class for different types of authentication credentials. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SecretStoreBasedAuthCredentials + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupRecoveryPoint(_Model): + """Azure backup recoveryPoint. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupDiscreteRecoveryPoint + + :ivar object_type: Required. Default value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint, discriminator="AzureBackupDiscreteRecoveryPoint"): + """Azure backup discrete RecoveryPoint. + + :ivar friendly_name: + :vartype friendly_name: str + :ivar recovery_point_data_stores_details: + :vartype recovery_point_data_stores_details: + list[~azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails] + :ivar recovery_point_time: Required. + :vartype recovery_point_time: ~datetime.datetime + :ivar policy_name: + :vartype policy_name: str + :ivar policy_version: + :vartype policy_version: str + :ivar recovery_point_id: + :vartype recovery_point_id: str + :ivar recovery_point_type: + :vartype recovery_point_type: str + :ivar retention_tag_name: + :vartype retention_tag_name: str + :ivar retention_tag_version: + :vartype retention_tag_version: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar recovery_point_state: Specifies recovery point completeness. Partial (i.e., only some of + the intended items were backed up), or Completed (i.e., ALL intended items were backed up). + Known values are: "Completed" and "Partial". + :vartype recovery_point_state: str or + ~azure.mgmt.dataprotection.models.RecoveryPointCompletionState + :ivar object_type: Required. Default value is "AzureBackupDiscreteRecoveryPoint". + :vartype object_type: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_point_data_stores_details: Optional[list["_models.RecoveryPointDataStoreDetails"]] = rest_field( + name="recoveryPointDataStoresDetails", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_point_time: datetime.datetime = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Required.""" + policy_name: Optional[str] = rest_field( + name="policyName", visibility=["read", "create", "update", "delete", "query"] + ) + policy_version: Optional[str] = rest_field( + name="policyVersion", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_point_type: Optional[str] = rest_field( + name="recoveryPointType", visibility=["read", "create", "update", "delete", "query"] + ) + retention_tag_name: Optional[str] = rest_field( + name="retentionTagName", visibility=["read", "create", "update", "delete", "query"] + ) + retention_tag_version: Optional[str] = rest_field( + name="retentionTagVersion", visibility=["read", "create", "update", "delete", "query"] + ) + expiry_time: Optional[datetime.datetime] = rest_field(name="expiryTime", visibility=["read"], format="rfc3339") + recovery_point_state: Optional[Union[str, "_models.RecoveryPointCompletionState"]] = rest_field( + name="recoveryPointState", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies recovery point completeness. Partial (i.e., only some of the intended items were + backed up), or Completed (i.e., ALL intended items were backed up). Known values are: + \"Completed\" and \"Partial\".""" + object_type: Literal["AzureBackupDiscreteRecoveryPoint"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"AzureBackupDiscreteRecoveryPoint\".""" + + @overload + def __init__( + self, + *, + recovery_point_time: datetime.datetime, + friendly_name: Optional[str] = None, + recovery_point_data_stores_details: Optional[list["_models.RecoveryPointDataStoreDetails"]] = None, + policy_name: Optional[str] = None, + policy_version: Optional[str] = None, + recovery_point_id: Optional[str] = None, + recovery_point_type: Optional[str] = None, + retention_tag_name: Optional[str] = None, + retention_tag_version: Optional[str] = None, + recovery_point_state: Optional[Union[str, "_models.RecoveryPointCompletionState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureBackupDiscreteRecoveryPoint" # type: ignore + + +class AzureBackupFindRestorableTimeRangesRequest(_Model): # pylint: disable=name-too-long + """List Restore Ranges Request. + + :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known + values are: "OperationalStore", "VaultStore", and "ArchiveStore". + :vartype source_data_store_type: str or + ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType + :ivar start_time: Start time for the List Restore Ranges request. ISO 8601 format. + :vartype start_time: str + :ivar end_time: End time for the List Restore Ranges request. ISO 8601 format. + :vartype end_time: str + """ + + source_data_store_type: Union[str, "_models.RestoreSourceDataStoreType"] = rest_field( + name="sourceDataStoreType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the source data store. Required. Known values are: + \"OperationalStore\", \"VaultStore\", and \"ArchiveStore\".""" + start_time: Optional[str] = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"]) + """Start time for the List Restore Ranges request. ISO 8601 format.""" + end_time: Optional[str] = rest_field(name="endTime", visibility=["read", "create", "update", "delete", "query"]) + """End time for the List Restore Ranges request. ISO 8601 format.""" + + @overload + def __init__( + self, + *, + source_data_store_type: Union[str, "_models.RestoreSourceDataStoreType"], + start_time: Optional[str] = None, + end_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupFindRestorableTimeRangesResponse(_Model): # pylint: disable=name-too-long + """List Restore Ranges Response. + + :ivar restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. + :vartype restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] + :ivar object_type: + :vartype object_type: str + """ + + restorable_time_ranges: Optional[list["_models.RestorableTimeRange"]] = rest_field( + name="restorableTimeRanges", visibility=["read", "create", "update", "delete", "query"] + ) + """Returns the Restore Ranges available on the Backup Instance.""" + object_type: Optional[str] = rest_field( + name="objectType", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + restorable_time_ranges: Optional[list["_models.RestorableTimeRange"]] = None, + object_type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DppResource(_Model): + """Resource class. + + :ivar id: Resource Id represents the complete path to the resource. + :vartype id: str + :ivar name: Resource name associated with the resource. + :vartype name: str + :ivar type: Resource type represents the complete path of the form + Namespace/ResourceType/ResourceType/... + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Resource Id represents the complete path to the resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Resource name associated with the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/...""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the resource.""" + + +class AzureBackupFindRestorableTimeRangesResponseResource(DppResource): # pylint: disable=name-too-long + """List Restore Ranges Response. + + :ivar id: Resource Id represents the complete path to the resource. + :vartype id: str + :ivar name: Resource name associated with the resource. + :vartype name: str + :ivar type: Resource type represents the complete path of the form + Namespace/ResourceType/ResourceType/... + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: AzureBackupFindRestorableTimeRangesResponseResource properties. + :vartype properties: + ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse + """ + + properties: Optional["_models.AzureBackupFindRestorableTimeRangesResponse"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """AzureBackupFindRestorableTimeRangesResponseResource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AzureBackupFindRestorableTimeRangesResponse"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupJob(_Model): + """AzureBackup Job Class. + + :ivar activity_id: Job Activity Id. Required. + :vartype activity_id: str + :ivar backup_instance_friendly_name: Name of the Backup Instance. Required. + :vartype backup_instance_friendly_name: str + :ivar backup_instance_id: ARM ID of the Backup Instance. + :vartype backup_instance_id: str + :ivar data_source_id: ARM ID of the DataSource. Required. + :vartype data_source_id: str + :ivar data_source_location: Location of the DataSource. Required. + :vartype data_source_location: str + :ivar data_source_name: User Friendly Name of the DataSource. Required. + :vartype data_source_name: str + :ivar data_source_set_name: Data Source Set Name of the DataSource. + :vartype data_source_set_name: str + :ivar data_source_type: Type of DataSource. Required. + :vartype data_source_type: str + :ivar duration: Total run time of the job. ISO 8601 format. + :vartype duration: str + :ivar end_time: EndTime of the job(in UTC). + :vartype end_time: ~datetime.datetime + :ivar error_details: A List, detailing the errors related to the job. + :vartype error_details: list[~azure.mgmt.dataprotection.models.UserFacingError] + :ivar extended_info: Extended Information about the job. + :vartype extended_info: ~azure.mgmt.dataprotection.models.JobExtendedInfo + :ivar is_user_triggered: Indicated that whether the job is adhoc(true) or scheduled(false). + Required. + :vartype is_user_triggered: bool + :ivar operation: It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; + Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. Required. + :vartype operation: str + :ivar operation_category: It indicates the type of Job i.e. Backup/Restore/Tiering/Management. + Required. + :vartype operation_category: str + :ivar policy_id: ARM ID of the policy. + :vartype policy_id: str + :ivar policy_name: Name of the policy. + :vartype policy_name: str + :ivar progress_enabled: Indicated whether progress is enabled for the job. Required. + :vartype progress_enabled: bool + :ivar progress_url: Url which contains job's progress. + :vartype progress_url: str + :ivar rehydration_priority: Priority to be used for rehydration. + :vartype rehydration_priority: str + :ivar restore_type: It indicates the sub type of operation i.e. in case of Restore it can be + ALR/OLR. + :vartype restore_type: str + :ivar source_resource_group: Resource Group Name of the Datasource. Required. + :vartype source_resource_group: str + :ivar source_subscription_id: SubscriptionId corresponding to the DataSource. Required. + :vartype source_subscription_id: str + :ivar start_time: StartTime of the job(in UTC). Required. + :vartype start_time: ~datetime.datetime + :ivar status: Status of the job like + InProgress/Completed/Failed/Cancelled/CompletedWithWarnings/Cancelling/Paused. Required. + :vartype status: str + :ivar subscription_id: Subscription Id of the corresponding backup vault. Required. + :vartype subscription_id: str + :ivar supported_actions: List of supported actions. Required. + :vartype supported_actions: list[str] + :ivar vault_name: Name of the vault. Required. + :vartype vault_name: str + :ivar etag: + :vartype etag: str + :ivar source_data_store_name: + :vartype source_data_store_name: str + :ivar destination_data_store_name: + :vartype destination_data_store_name: str + """ + + activity_id: str = rest_field(name="activityID", visibility=["read", "create", "update", "delete", "query"]) + """Job Activity Id. Required.""" + backup_instance_friendly_name: str = rest_field( + name="backupInstanceFriendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the Backup Instance. Required.""" + backup_instance_id: Optional[str] = rest_field(name="backupInstanceId", visibility=["read"]) + """ARM ID of the Backup Instance.""" + data_source_id: str = rest_field(name="dataSourceId", visibility=["read", "create", "update", "delete", "query"]) + """ARM ID of the DataSource. Required.""" + data_source_location: str = rest_field( + name="dataSourceLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Location of the DataSource. Required.""" + data_source_name: str = rest_field( + name="dataSourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """User Friendly Name of the DataSource. Required.""" + data_source_set_name: Optional[str] = rest_field( + name="dataSourceSetName", visibility=["read", "create", "update", "delete", "query"] + ) + """Data Source Set Name of the DataSource.""" + data_source_type: str = rest_field( + name="dataSourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of DataSource. Required.""" + duration: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Total run time of the job. ISO 8601 format.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """EndTime of the job(in UTC).""" + error_details: Optional[list["_models.UserFacingError"]] = rest_field(name="errorDetails", visibility=["read"]) + """A List, detailing the errors related to the job.""" + extended_info: Optional["_models.JobExtendedInfo"] = rest_field(name="extendedInfo", visibility=["read"]) + """Extended Information about the job.""" + is_user_triggered: bool = rest_field( + name="isUserTriggered", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicated that whether the job is adhoc(true) or scheduled(false). Required.""" + operation: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive + ; Management:ConfigureProtection/UnConfigure. Required.""" + operation_category: str = rest_field( + name="operationCategory", visibility=["read", "create", "update", "delete", "query"] + ) + """It indicates the type of Job i.e. Backup/Restore/Tiering/Management. Required.""" + policy_id: Optional[str] = rest_field(name="policyId", visibility=["read"]) + """ARM ID of the policy.""" + policy_name: Optional[str] = rest_field(name="policyName", visibility=["read"]) + """Name of the policy.""" + progress_enabled: bool = rest_field( + name="progressEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicated whether progress is enabled for the job. Required.""" + progress_url: Optional[str] = rest_field(name="progressUrl", visibility=["read"]) + """Url which contains job's progress.""" + rehydration_priority: Optional[str] = rest_field(name="rehydrationPriority", visibility=["read"]) + """Priority to be used for rehydration.""" + restore_type: Optional[str] = rest_field(name="restoreType", visibility=["read"]) + """It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR.""" + source_resource_group: str = rest_field( + name="sourceResourceGroup", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Group Name of the Datasource. Required.""" + source_subscription_id: str = rest_field( + name="sourceSubscriptionID", visibility=["read", "create", "update", "delete", "query"] + ) + """SubscriptionId corresponding to the DataSource. Required.""" + start_time: datetime.datetime = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """StartTime of the job(in UTC). Required.""" + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Status of the job like + InProgress/Completed/Failed/Cancelled/CompletedWithWarnings/Cancelling/Paused. Required.""" + subscription_id: str = rest_field(name="subscriptionId", visibility=["read", "create", "update", "delete", "query"]) + """Subscription Id of the corresponding backup vault. Required.""" + supported_actions: list[str] = rest_field( + name="supportedActions", visibility=["read", "create", "update", "delete", "query"] + ) + """List of supported actions. Required.""" + vault_name: str = rest_field(name="vaultName", visibility=["read", "create", "update", "delete", "query"]) + """Name of the vault. Required.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + source_data_store_name: Optional[str] = rest_field( + name="sourceDataStoreName", visibility=["read", "create", "update", "delete", "query"] + ) + destination_data_store_name: Optional[str] = rest_field( + name="destinationDataStoreName", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + activity_id: str, + backup_instance_friendly_name: str, + data_source_id: str, + data_source_location: str, + data_source_name: str, + data_source_type: str, + is_user_triggered: bool, + operation: str, + operation_category: str, + progress_enabled: bool, + source_resource_group: str, + source_subscription_id: str, + start_time: datetime.datetime, + status: str, + subscription_id: str, + supported_actions: list[str], + vault_name: str, + data_source_set_name: Optional[str] = None, + duration: Optional[str] = None, + etag: Optional[str] = None, + source_data_store_name: Optional[str] = None, + destination_data_store_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + """ + + +class AzureBackupJobResource(ProxyResource): + """AzureBackup Job Resource Class. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: AzureBackupJobResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.AzureBackupJob + """ + + properties: Optional["_models.AzureBackupJob"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """AzureBackupJobResource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AzureBackupJob"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupParameters(_Model): + """BackupParameters base. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupParams + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupParams(BackupParameters, discriminator="AzureBackupParams"): + """Azure backup parameters. + + :ivar backup_type: BackupType ; Full/Incremental etc. Required. + :vartype backup_type: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "AzureBackupParams". + :vartype object_type: str + """ + + backup_type: str = rest_field(name="backupType", visibility=["read", "create", "update", "delete", "query"]) + """BackupType ; Full/Incremental etc. Required.""" + object_type: Literal["AzureBackupParams"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"AzureBackupParams\".""" + + @overload + def __init__( + self, + *, + backup_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureBackupParams" # type: ignore + + +class AzureBackupRestoreRequest(_Model): + """Azure backup restore request. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupRecoveryPointBasedRestoreRequest, AzureBackupRecoveryTimeBasedRestoreRequest, + AzureBackupRestoreWithRehydrationRequest + + :ivar object_type: Required. Default value is None. + :vartype object_type: str + :ivar restore_target_info: Gets or sets the restore target information. Required. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is None.""" + restore_target_info: "_models.RestoreTargetInfoBase" = rest_field( + name="restoreTargetInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the restore target information. Required.""" + source_data_store_type: Union[str, "_models.SourceDataStoreType"] = rest_field( + name="sourceDataStoreType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the source data store. Required. Known values are: \"ArchiveStore\", + \"SnapshotStore\", \"OperationalStore\", and \"VaultStore\".""" + source_resource_id: Optional[str] = rest_field( + name="sourceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Fully qualified Azure Resource Manager ID of the datasource which is being recovered.""" + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + identity_details: Optional["_models.IdentityDetails"] = rest_field( + name="identityDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned.""" + + @overload + def __init__( + self, + *, + object_type: str, + restore_target_info: "_models.RestoreTargetInfoBase", + source_data_store_type: Union[str, "_models.SourceDataStoreType"], + source_resource_id: Optional[str] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupRecoveryPointBasedRestoreRequest( + AzureBackupRestoreRequest, discriminator="AzureBackupRecoveryPointBasedRestoreRequest" +): # pylint: disable=name-too-long + """Azure backup recoveryPoint based restore request. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupRestoreWithRehydrationRequest + + :ivar restore_target_info: Gets or sets the restore target information. Required. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails + :ivar recovery_point_id: Required. + :vartype recovery_point_id: str + :ivar object_type: Required. Default value is "AzureBackupRecoveryPointBasedRestoreRequest". + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + recovery_point_id: str = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + object_type: Literal["AzureBackupRecoveryPointBasedRestoreRequest"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"AzureBackupRecoveryPointBasedRestoreRequest\".""" + + @overload + def __init__( + self, + *, + restore_target_info: "_models.RestoreTargetInfoBase", + source_data_store_type: Union[str, "_models.SourceDataStoreType"], + recovery_point_id: str, + source_resource_id: Optional[str] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureBackupRecoveryPointBasedRestoreRequest" # type: ignore + + +class AzureBackupRecoveryPointResource(ProxyResource): + """Azure backup recoveryPoint resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: AzureBackupRecoveryPointResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint + """ + + properties: Optional["_models.AzureBackupRecoveryPoint"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """AzureBackupRecoveryPointResource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.AzureBackupRecoveryPoint"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupRecoveryTimeBasedRestoreRequest( + AzureBackupRestoreRequest, discriminator="AzureBackupRecoveryTimeBasedRestoreRequest" +): # pylint: disable=name-too-long + """AzureBackup RecoveryPointTime Based Restore Request. + + :ivar restore_target_info: Gets or sets the restore target information. Required. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails + :ivar recovery_point_time: The recovery time in ISO 8601 format example - + 2020-08-14T17:30:00.0000000Z. Required. + :vartype recovery_point_time: str + :ivar object_type: Required. Default value is "AzureBackupRecoveryTimeBasedRestoreRequest". + :vartype object_type: str + """ + + recovery_point_time: str = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. Required.""" + object_type: Literal["AzureBackupRecoveryTimeBasedRestoreRequest"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"AzureBackupRecoveryTimeBasedRestoreRequest\".""" + + @overload + def __init__( + self, + *, + restore_target_info: "_models.RestoreTargetInfoBase", + source_data_store_type: Union[str, "_models.SourceDataStoreType"], + recovery_point_time: str, + source_resource_id: Optional[str] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureBackupRecoveryTimeBasedRestoreRequest" # type: ignore + + +class AzureBackupRehydrationRequest(_Model): + """Azure Backup Rehydrate Request. + + :ivar recovery_point_id: Id of the recovery point to be recovered. Required. + :vartype recovery_point_id: str + :ivar rehydration_priority: Priority to be used for rehydration. Values High or Standard. Known + values are: "Invalid", "High", and "Standard". + :vartype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority + :ivar rehydration_retention_duration: Retention duration in ISO 8601 format i.e P10D . + Required. + :vartype rehydration_retention_duration: str + """ + + recovery_point_id: str = rest_field( + name="recoveryPointId", visibility=["read", "create", "update", "delete", "query"] + ) + """Id of the recovery point to be recovered. Required.""" + rehydration_priority: Optional[Union[str, "_models.RehydrationPriority"]] = rest_field( + name="rehydrationPriority", visibility=["read", "create", "update", "delete", "query"] + ) + """Priority to be used for rehydration. Values High or Standard. Known values are: \"Invalid\", + \"High\", and \"Standard\".""" + rehydration_retention_duration: str = rest_field( + name="rehydrationRetentionDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention duration in ISO 8601 format i.e P10D . Required.""" + + @overload + def __init__( + self, + *, + recovery_point_id: str, + rehydration_retention_duration: str, + rehydration_priority: Optional[Union[str, "_models.RehydrationPriority"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupRestoreWithRehydrationRequest( + AzureBackupRecoveryPointBasedRestoreRequest, discriminator="AzureBackupRestoreWithRehydrationRequest" +): + """AzureBackup Restore with Rehydration Request. + + :ivar restore_target_info: Gets or sets the restore target information. Required. + :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase + :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". + :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType + :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is + being recovered. + :vartype source_resource_id: str + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails + :ivar recovery_point_id: Required. + :vartype recovery_point_id: str + :ivar rehydration_priority: Priority to be used for rehydration. Values High or Standard. + Required. Known values are: "Invalid", "High", and "Standard". + :vartype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority + :ivar rehydration_retention_duration: Retention duration in ISO 8601 format i.e P10D . + Required. + :vartype rehydration_retention_duration: str + :ivar object_type: Required. Default value is "AzureBackupRestoreWithRehydrationRequest". + :vartype object_type: str + """ + + rehydration_priority: Union[str, "_models.RehydrationPriority"] = rest_field( + name="rehydrationPriority", visibility=["read", "create", "update", "delete", "query"] + ) + """Priority to be used for rehydration. Values High or Standard. Required. Known values are: + \"Invalid\", \"High\", and \"Standard\".""" + rehydration_retention_duration: str = rest_field( + name="rehydrationRetentionDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention duration in ISO 8601 format i.e P10D . Required.""" + object_type: Literal["AzureBackupRestoreWithRehydrationRequest"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"AzureBackupRestoreWithRehydrationRequest\".""" + + @overload + def __init__( + self, + *, + restore_target_info: "_models.RestoreTargetInfoBase", + source_data_store_type: Union[str, "_models.SourceDataStoreType"], + recovery_point_id: str, + rehydration_priority: Union[str, "_models.RehydrationPriority"], + rehydration_retention_duration: str, + source_resource_id: Optional[str] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureBackupRestoreWithRehydrationRequest" # type: ignore + + +class BasePolicyRule(_Model): + """BasePolicy Rule. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureBackupRule, AzureRetentionRule + + :ivar name: Required. + :vartype name: str + :ivar object_type: Required. Default value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is None.""" + + @overload + def __init__( + self, + *, + name: str, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBackupRule(BasePolicyRule, discriminator="AzureBackupRule"): + """Azure backup rule. + + :ivar name: Required. + :vartype name: str + :ivar backup_parameters: BackupParameters base. + :vartype backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters + :ivar data_store: DataStoreInfo base. Required. + :vartype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :ivar trigger: Trigger context. Required. + :vartype trigger: ~azure.mgmt.dataprotection.models.TriggerContext + :ivar object_type: Required. Default value is "AzureBackupRule". + :vartype object_type: str + """ + + backup_parameters: Optional["_models.BackupParameters"] = rest_field( + name="backupParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """BackupParameters base.""" + data_store: "_models.DataStoreInfoBase" = rest_field( + name="dataStore", visibility=["read", "create", "update", "delete", "query"] + ) + """DataStoreInfo base. Required.""" + trigger: "_models.TriggerContext" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Trigger context. Required.""" + object_type: Literal["AzureBackupRule"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"AzureBackupRule\".""" + + @overload + def __init__( + self, + *, + name: str, + data_store: "_models.DataStoreInfoBase", + trigger: "_models.TriggerContext", + backup_parameters: Optional["_models.BackupParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureBackupRule" # type: ignore + + +class AzureMonitorAlertSettings(_Model): + """Settings for Azure Monitor based alerts. + + :ivar alerts_for_all_job_failures: Known values are: "Enabled" and "Disabled". + :vartype alerts_for_all_job_failures: str or ~azure.mgmt.dataprotection.models.AlertsState + """ + + alerts_for_all_job_failures: Optional[Union[str, "_models.AlertsState"]] = rest_field( + name="alertsForAllJobFailures", visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + alerts_for_all_job_failures: Optional[Union[str, "_models.AlertsState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataStoreParameters(_Model): + """Parameters for DataStore. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureOperationalStoreParameters + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + :ivar data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values + are: "OperationalStore", "VaultStore", and "ArchiveStore". + :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + data_store_type: Union[str, "_models.DataStoreTypes"] = rest_field( + name="dataStoreType", visibility=["read", "create", "update", "delete", "query"] + ) + """type of datastore; Operational/Vault/Archive. Required. Known values are: \"OperationalStore\", + \"VaultStore\", and \"ArchiveStore\".""" + + @overload + def __init__( + self, + *, + object_type: str, + data_store_type: Union[str, "_models.DataStoreTypes"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureOperationalStoreParameters(DataStoreParameters, discriminator="AzureOperationalStoreParameters"): + """Parameters for Operational-Tier DataStore. + + :ivar data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values + are: "OperationalStore", "VaultStore", and "ArchiveStore". + :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :ivar resource_group_id: Gets or sets the Snapshot Resource Group Uri. + :vartype resource_group_id: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "AzureOperationalStoreParameters". + :vartype object_type: str + """ + + resource_group_id: Optional[str] = rest_field( + name="resourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Snapshot Resource Group Uri.""" + object_type: Literal["AzureOperationalStoreParameters"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"AzureOperationalStoreParameters\".""" + + @overload + def __init__( + self, + *, + data_store_type: Union[str, "_models.DataStoreTypes"], + resource_group_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureOperationalStoreParameters" # type: ignore + + +class AzureRetentionRule(BasePolicyRule, discriminator="AzureRetentionRule"): + """Azure retention rule. + + :ivar name: Required. + :vartype name: str + :ivar is_default: + :vartype is_default: bool + :ivar lifecycles: Required. + :vartype lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] + :ivar object_type: Required. Default value is "AzureRetentionRule". + :vartype object_type: str + """ + + is_default: Optional[bool] = rest_field( + name="isDefault", visibility=["read", "create", "update", "delete", "query"] + ) + lifecycles: list["_models.SourceLifeCycle"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + object_type: Literal["AzureRetentionRule"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"AzureRetentionRule\".""" + + @overload + def __init__( + self, + *, + name: str, + lifecycles: list["_models.SourceLifeCycle"], + is_default: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "AzureRetentionRule" # type: ignore + + +class BackupCriteria(_Model): + """BackupCriteria base class. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ScheduleBasedBackupCriteria + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupInstance(_Model): + """Backup Instance. + + :ivar friendly_name: Gets or sets the Backup Instance friendly name. + :vartype friendly_name: str + :ivar data_source_info: Gets or sets the data source information. Required. + :vartype data_source_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar data_source_set_info: Gets or sets the data source set information. + :vartype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar policy_info: Gets or sets the policy information. Required. + :vartype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar protection_status: Specifies the protection status of the resource. + :vartype protection_status: ~azure.mgmt.dataprotection.models.ProtectionStatusDetails + :ivar current_protection_state: Specifies the current protection state of the resource. Known + values are: "Invalid", "NotProtected", "ConfiguringProtection", "ProtectionConfigured", + "BackupSchedulesSuspended", "RetentionSchedulesSuspended", "ProtectionStopped", + "ProtectionError", "ConfiguringProtectionFailed", "SoftDeleting", "SoftDeleted", and + "UpdatingProtection". + :vartype current_protection_state: str or + ~azure.mgmt.dataprotection.models.CurrentProtectionState + :ivar protection_error_details: Specifies the protection error of the resource. + :vartype protection_error_details: ~azure.mgmt.dataprotection.models.UserFacingError + :ivar provisioning_state: Specifies the provisioning state of the resource i.e. + provisioning/updating/Succeeded/Failed. + :vartype provisioning_state: str + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :ivar validation_type: Specifies the type of validation. In case of DeepValidation, all + validations from /validateForBackup API will run again. Known values are: "ShallowValidation" + and "DeepValidation". + :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails + :ivar object_type: Required. + :vartype object_type: str + """ + + friendly_name: Optional[str] = rest_field( + name="friendlyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Backup Instance friendly name.""" + data_source_info: "_models.Datasource" = rest_field( + name="dataSourceInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the data source information. Required.""" + data_source_set_info: Optional["_models.DatasourceSet"] = rest_field( + name="dataSourceSetInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the data source set information.""" + policy_info: "_models.PolicyInfo" = rest_field( + name="policyInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the policy information. Required.""" + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + protection_status: Optional["_models.ProtectionStatusDetails"] = rest_field( + name="protectionStatus", visibility=["read"] + ) + """Specifies the protection status of the resource.""" + current_protection_state: Optional[Union[str, "_models.CurrentProtectionState"]] = rest_field( + name="currentProtectionState", visibility=["read"] + ) + """Specifies the current protection state of the resource. Known values are: \"Invalid\", + \"NotProtected\", \"ConfiguringProtection\", \"ProtectionConfigured\", + \"BackupSchedulesSuspended\", \"RetentionSchedulesSuspended\", \"ProtectionStopped\", + \"ProtectionError\", \"ConfiguringProtectionFailed\", \"SoftDeleting\", \"SoftDeleted\", and + \"UpdatingProtection\".""" + protection_error_details: Optional["_models.UserFacingError"] = rest_field( + name="protectionErrorDetails", visibility=["read"] + ) + """Specifies the protection error of the resource.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed.""" + datasource_auth_credentials: Optional["_models.AuthCredentials"] = rest_field( + name="datasourceAuthCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """Credentials to use to authenticate with data source provider.""" + validation_type: Optional[Union[str, "_models.ValidationType"]] = rest_field( + name="validationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the type of validation. In case of DeepValidation, all validations from + /validateForBackup API will run again. Known values are: \"ShallowValidation\" and + \"DeepValidation\".""" + identity_details: Optional["_models.IdentityDetails"] = rest_field( + name="identityDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned.""" + object_type: str = rest_field(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + data_source_info: "_models.Datasource", + policy_info: "_models.PolicyInfo", + object_type: str, + friendly_name: Optional[str] = None, + data_source_set_info: Optional["_models.DatasourceSet"] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, + validation_type: Optional[Union[str, "_models.ValidationType"]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupInstanceResource(ProxyResource): + """BackupInstance Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: BackupInstanceResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.BackupInstance + :ivar tags: Proxy Resource tags. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.BackupInstance"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """BackupInstanceResource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Proxy Resource tags.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.BackupInstance"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BaseBackupPolicy(_Model): + """BackupPolicy base. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BackupPolicy + + :ivar datasource_types: Type of datasource for the backup management. Required. + :vartype datasource_types: list[str] + :ivar object_type: Required. Default value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + datasource_types: list[str] = rest_field( + name="datasourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of datasource for the backup management. Required.""" + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Required. Default value is None.""" + + @overload + def __init__( + self, + *, + datasource_types: list[str], + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupPolicy(BaseBackupPolicy, discriminator="BackupPolicy"): + """Rule based backup policy. + + :ivar datasource_types: Type of datasource for the backup management. Required. + :vartype datasource_types: list[str] + :ivar policy_rules: Policy rule dictionary that contains rules for each backuptype i.e + Full/Incremental/Logs etc. Required. + :vartype policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] + :ivar object_type: Required. Default value is "BackupPolicy". + :vartype object_type: str + """ + + policy_rules: list["_models.BasePolicyRule"] = rest_field( + name="policyRules", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc. + Required.""" + object_type: Literal["BackupPolicy"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"BackupPolicy\".""" + + @overload + def __init__( + self, + *, + datasource_types: list[str], + policy_rules: list["_models.BasePolicyRule"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "BackupPolicy" # type: ignore + + +class BackupSchedule(_Model): + """Schedule for backup. + + :ivar repeating_time_intervals: Repeating time interval which only support the following ISO + 8601 format [R/startDateTime/Duration]. Example: R/2007-03-01T13:00:00Z/P1Y2M10DT2H30M. + Required. + :vartype repeating_time_intervals: list[str] + :ivar time_zone: Time zone for a schedule. Example: Pacific Standard Time. + :vartype time_zone: str + """ + + repeating_time_intervals: list[str] = rest_field( + name="repeatingTimeIntervals", visibility=["read", "create", "update", "delete", "query"] + ) + """Repeating time interval which only support the following ISO 8601 format + [R/startDateTime/Duration]. Example: R/2007-03-01T13:00:00Z/P1Y2M10DT2H30M. Required.""" + time_zone: Optional[str] = rest_field(name="timeZone", visibility=["read", "create", "update", "delete", "query"]) + """Time zone for a schedule. Example: Pacific Standard Time.""" + + @overload + def __init__( + self, + *, + repeating_time_intervals: list[str], + time_zone: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupVault(_Model): + """Backup Vault. + + :ivar monitoring_settings: Monitoring Settings. + :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings + :ivar provisioning_state: Provisioning state of the BackupVault resource. Known values are: + "Failed", "Provisioning", "Succeeded", "Unknown", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState + :ivar resource_move_state: Resource move state for backup vault. Known values are: "Unknown", + "InProgress", "PrepareFailed", "CommitFailed", "Failed", "PrepareTimedout", "CommitTimedout", + "CriticalFailure", "PartialSuccess", and "MoveSucceeded". + :vartype resource_move_state: str or ~azure.mgmt.dataprotection.models.ResourceMoveState + :ivar resource_move_details: Resource move details for backup vault. + :vartype resource_move_details: ~azure.mgmt.dataprotection.models.ResourceMoveDetails + :ivar security_settings: Security Settings. + :vartype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings + :ivar storage_settings: Storage Settings. Required. + :vartype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] + :ivar is_vault_protected_by_resource_guard: Is vault protected by resource guard. + :vartype is_vault_protected_by_resource_guard: bool + :ivar feature_settings: Feature Settings. + :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings + :ivar secure_score: Secure Score of Backup Vault. Known values are: "None", "Minimum", + "Adequate", "Maximum", and "NotSupported". + :vartype secure_score: str or ~azure.mgmt.dataprotection.models.SecureScoreLevel + :ivar bcdr_security_level: Security Level of Backup Vault. Known values are: "Poor", "Fair", + "Good", "Excellent", and "NotSupported". + :vartype bcdr_security_level: str or ~azure.mgmt.dataprotection.models.BCDRSecurityLevel + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar replicated_regions: List of replicated regions for Backup Vault. + :vartype replicated_regions: list[str] + """ + + monitoring_settings: Optional["_models.MonitoringSettings"] = rest_field( + name="monitoringSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Monitoring Settings.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the BackupVault resource. Known values are: \"Failed\", \"Provisioning\", + \"Succeeded\", \"Unknown\", and \"Updating\".""" + resource_move_state: Optional[Union[str, "_models.ResourceMoveState"]] = rest_field( + name="resourceMoveState", visibility=["read"] + ) + """Resource move state for backup vault. Known values are: \"Unknown\", \"InProgress\", + \"PrepareFailed\", \"CommitFailed\", \"Failed\", \"PrepareTimedout\", \"CommitTimedout\", + \"CriticalFailure\", \"PartialSuccess\", and \"MoveSucceeded\".""" + resource_move_details: Optional["_models.ResourceMoveDetails"] = rest_field( + name="resourceMoveDetails", visibility=["read"] + ) + """Resource move details for backup vault.""" + security_settings: Optional["_models.SecuritySettings"] = rest_field( + name="securitySettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Security Settings.""" + storage_settings: list["_models.StorageSetting"] = rest_field( + name="storageSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Storage Settings. Required.""" + is_vault_protected_by_resource_guard: Optional[bool] = rest_field( + name="isVaultProtectedByResourceGuard", visibility=["read"] + ) + """Is vault protected by resource guard.""" + feature_settings: Optional["_models.FeatureSettings"] = rest_field( + name="featureSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Feature Settings.""" + secure_score: Optional[Union[str, "_models.SecureScoreLevel"]] = rest_field(name="secureScore", visibility=["read"]) + """Secure Score of Backup Vault. Known values are: \"None\", \"Minimum\", \"Adequate\", + \"Maximum\", and \"NotSupported\".""" + bcdr_security_level: Optional[Union[str, "_models.BCDRSecurityLevel"]] = rest_field( + name="bcdrSecurityLevel", visibility=["read"] + ) + """Security Level of Backup Vault. Known values are: \"Poor\", \"Fair\", \"Good\", \"Excellent\", + and \"NotSupported\".""" + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + replicated_regions: Optional[list[str]] = rest_field( + name="replicatedRegions", visibility=["read", "create", "update", "delete", "query"] + ) + """List of replicated regions for Backup Vault.""" + + @overload + def __init__( + self, + *, + storage_settings: list["_models.StorageSetting"], + monitoring_settings: Optional["_models.MonitoringSettings"] = None, + security_settings: Optional["_models.SecuritySettings"] = None, + feature_settings: Optional["_models.FeatureSettings"] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + replicated_regions: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupVaultResource(TrackedResource): + """Backup Vault Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: BackupVaultResource properties. Required. + :vartype properties: ~azure.mgmt.dataprotection.models.BackupVault + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :ivar e_tag: Optional ETag. + :vartype e_tag: str + """ + + properties: "_models.BackupVault" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """BackupVaultResource properties. Required.""" + identity: Optional["_models.DppIdentityDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Input Managed Identity Details.""" + e_tag: Optional[str] = rest_field(name="eTag", visibility=["read", "create", "update", "delete", "query"]) + """Optional ETag.""" + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.BackupVault", + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.DppIdentityDetails"] = None, + e_tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BaseBackupPolicyResource(ProxyResource): + """BaseBackupPolicy resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: BaseBackupPolicyResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy + """ + + properties: Optional["_models.BaseBackupPolicy"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """BaseBackupPolicyResource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.BaseBackupPolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BaseResourceProperties(_Model): + """Properties which are specific to datasource/datasourceSets. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DefaultResourceProperties + + :ivar object_type: Type of the specific object - used for deserializing. Required. + "DefaultResourceProperties" + :vartype object_type: str or ~azure.mgmt.dataprotection.models.ResourcePropertiesObjectType + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. \"DefaultResourceProperties\"""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityRequest(_Model): + """CheckNameAvailability Request. + + :ivar name: Resource name for which availability needs to be checked. + :vartype name: str + :ivar type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. + :vartype type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource name for which availability needs to be checked.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the Resource type: Microsoft.DataProtection/BackupVaults.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityResult(_Model): + """CheckNameAvailability Result. + + :ivar message: Gets or sets the message. + :vartype message: str + :ivar name_available: Gets or sets a value indicating whether [name available]. + :vartype name_available: bool + :ivar reason: Gets or sets the reason. + :vartype reason: str + """ + + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the message.""" + name_available: Optional[bool] = rest_field( + name="nameAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets a value indicating whether [name available].""" + reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the reason.""" + + @overload + def __init__( + self, + *, + message: Optional[str] = None, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudError(_Model): + """An error response from Azure Backup. + + :ivar error: The resource management error response. + :vartype error: ~azure.mgmt.dataprotection.models.Error + """ + + error: Optional["_models.Error"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource management error response.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.Error"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CmkKekIdentity(_Model): + """The details of the managed identity used for CMK. + + :ivar identity_type: The identity type. 'SystemAssigned' and 'UserAssigned' are mutually + exclusive. 'SystemAssigned' will use implicitly created managed identity. Known values are: + "SystemAssigned" and "UserAssigned". + :vartype identity_type: str or ~azure.mgmt.dataprotection.models.IdentityType + :ivar identity_id: The managed identity to be used which has access permissions to the Key + Vault. Provide a value here in case identity types: 'UserAssigned' only. + :vartype identity_id: str + """ + + identity_type: Optional[Union[str, "_models.IdentityType"]] = rest_field( + name="identityType", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity type. 'SystemAssigned' and 'UserAssigned' are mutually exclusive. 'SystemAssigned' + will use implicitly created managed identity. Known values are: \"SystemAssigned\" and + \"UserAssigned\".""" + identity_id: Optional[str] = rest_field( + name="identityId", visibility=["read", "create", "update", "delete", "query"] + ) + """The managed identity to be used which has access permissions to the Key Vault. Provide a value + here in case identity types: 'UserAssigned' only.""" + + @overload + def __init__( + self, + *, + identity_type: Optional[Union[str, "_models.IdentityType"]] = None, + identity_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CmkKeyVaultProperties(_Model): + """The properties of the Key Vault which hosts CMK. + + :ivar key_uri: The key uri of the Customer Managed Key. + :vartype key_uri: str + """ + + key_uri: Optional[str] = rest_field(name="keyUri", visibility=["read", "create", "update", "delete", "query"]) + """The key uri of the Customer Managed Key.""" + + @overload + def __init__( + self, + *, + key_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CopyOption(_Model): + """Options to copy. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CopyOnExpiryOption, CustomCopyOption, ImmediateCopyOption + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CopyOnExpiryOption(CopyOption, discriminator="CopyOnExpiryOption"): + """Copy on Expiry Option. + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "CopyOnExpiryOption". + :vartype object_type: str + """ + + object_type: Literal["CopyOnExpiryOption"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"CopyOnExpiryOption\".""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "CopyOnExpiryOption" # type: ignore + + +class CrossRegionRestoreDetails(_Model): + """Cross Region Restore details. + + :ivar source_region: Required. + :vartype source_region: str + :ivar source_backup_instance_id: Required. + :vartype source_backup_instance_id: str + """ + + source_region: str = rest_field(name="sourceRegion", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + source_backup_instance_id: str = rest_field( + name="sourceBackupInstanceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + + @overload + def __init__( + self, + *, + source_region: str, + source_backup_instance_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CrossRegionRestoreJobRequest(_Model): + """Details of CRR Job to be fetched. + + :ivar source_region: Required. + :vartype source_region: str + :ivar source_backup_vault_id: Required. + :vartype source_backup_vault_id: str + :ivar job_id: Required. + :vartype job_id: str + """ + + source_region: str = rest_field(name="sourceRegion", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + source_backup_vault_id: str = rest_field( + name="sourceBackupVaultId", visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + job_id: str = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + source_region: str, + source_backup_vault_id: str, + job_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CrossRegionRestoreJobsRequest(_Model): + """Details of Backup Vault for which CRR Jobs are to be fetched. + + :ivar source_region: Required. + :vartype source_region: str + :ivar source_backup_vault_id: Required. + :vartype source_backup_vault_id: str + """ + + source_region: str = rest_field(name="sourceRegion", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + source_backup_vault_id: str = rest_field( + name="sourceBackupVaultId", visibility=["read", "create", "update", "delete", "query"] + ) + """Required.""" + + @overload + def __init__( + self, + *, + source_region: str, + source_backup_vault_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CrossRegionRestoreRequestObject(_Model): + """Cross Region Restore Request Object. + + :ivar restore_request_object: Gets or sets the restore request object. Required. + :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :ivar cross_region_restore_details: Cross region restore details. Required. + :vartype cross_region_restore_details: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails + """ + + restore_request_object: "_models.AzureBackupRestoreRequest" = rest_field( + name="restoreRequestObject", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the restore request object. Required.""" + cross_region_restore_details: "_models.CrossRegionRestoreDetails" = rest_field( + name="crossRegionRestoreDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Cross region restore details. Required.""" + + @overload + def __init__( + self, + *, + restore_request_object: "_models.AzureBackupRestoreRequest", + cross_region_restore_details: "_models.CrossRegionRestoreDetails", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CrossRegionRestoreSettings(_Model): + """CrossRegionRestoreSettings. + + :ivar state: CrossRegionRestore state. Known values are: "Disabled" and "Enabled". + :vartype state: str or ~azure.mgmt.dataprotection.models.CrossRegionRestoreState + """ + + state: Optional[Union[str, "_models.CrossRegionRestoreState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """CrossRegionRestore state. Known values are: \"Disabled\" and \"Enabled\".""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.CrossRegionRestoreState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CrossSubscriptionRestoreSettings(_Model): + """CrossSubscriptionRestore Settings. + + :ivar state: CrossSubscriptionRestore state. Known values are: "Disabled", + "PermanentlyDisabled", and "Enabled". + :vartype state: str or ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreState + """ + + state: Optional[Union[str, "_models.CrossSubscriptionRestoreState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """CrossSubscriptionRestore state. Known values are: \"Disabled\", \"PermanentlyDisabled\", and + \"Enabled\".""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.CrossSubscriptionRestoreState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CustomCopyOption(CopyOption, discriminator="CustomCopyOption"): + """Duration based custom options to copy. + + :ivar duration: Data copied after given timespan. + :vartype duration: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "CustomCopyOption". + :vartype object_type: str + """ + + duration: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Data copied after given timespan.""" + object_type: Literal["CustomCopyOption"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"CustomCopyOption\".""" + + @overload + def __init__( + self, + *, + duration: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "CustomCopyOption" # type: ignore + + +class Datasource(_Model): + """Datasource to be backed up. + + :ivar datasource_type: DatasourceType of the resource. + :vartype datasource_type: str + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + :vartype object_type: str + :ivar resource_id: Full ARM ID of the resource. For azure resources, this is ARM ID. For non + azure resources, this will be the ID created by backup service via Fabric/Vault. Required. + :vartype resource_id: str + :ivar resource_location: Location of datasource. + :vartype resource_location: str + :ivar resource_name: Unique identifier of the resource in the context of parent. + :vartype resource_name: str + :ivar resource_type: Resource Type of Datasource. + :vartype resource_type: str + :ivar resource_uri: Uri of the resource. + :vartype resource_uri: str + :ivar resource_properties: Properties specific to data source. + :vartype resource_properties: ~azure.mgmt.dataprotection.models.BaseResourceProperties + """ + + datasource_type: Optional[str] = rest_field( + name="datasourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """DatasourceType of the resource.""" + object_type: Optional[str] = rest_field( + name="objectType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of Datasource object, used to initialize the right inherited type.""" + resource_id: str = rest_field(name="resourceID", visibility=["read", "create", "update", "delete", "query"]) + """Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this + will be the ID created by backup service via Fabric/Vault. Required.""" + resource_location: Optional[str] = rest_field( + name="resourceLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Location of datasource.""" + resource_name: Optional[str] = rest_field( + name="resourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """Unique identifier of the resource in the context of parent.""" + resource_type: Optional[str] = rest_field( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Type of Datasource.""" + resource_uri: Optional[str] = rest_field( + name="resourceUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Uri of the resource.""" + resource_properties: Optional["_models.BaseResourceProperties"] = rest_field( + name="resourceProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties specific to data source.""" + + @overload + def __init__( + self, + *, + resource_id: str, + datasource_type: Optional[str] = None, + object_type: Optional[str] = None, + resource_location: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + resource_uri: Optional[str] = None, + resource_properties: Optional["_models.BaseResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatasourceSet(_Model): + """DatasourceSet details of datasource to be backed up. + + :ivar datasource_type: DatasourceType of the resource. + :vartype datasource_type: str + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + :vartype object_type: str + :ivar resource_id: Full ARM ID of the resource. For azure resources, this is ARM ID. For non + azure resources, this will be the ID created by backup service via Fabric/Vault. Required. + :vartype resource_id: str + :ivar resource_location: Location of datasource. + :vartype resource_location: str + :ivar resource_name: Unique identifier of the resource in the context of parent. + :vartype resource_name: str + :ivar resource_type: Resource Type of Datasource. + :vartype resource_type: str + :ivar resource_uri: Uri of the resource. + :vartype resource_uri: str + :ivar resource_properties: Properties specific to data source set. + :vartype resource_properties: ~azure.mgmt.dataprotection.models.BaseResourceProperties + """ + + datasource_type: Optional[str] = rest_field( + name="datasourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """DatasourceType of the resource.""" + object_type: Optional[str] = rest_field( + name="objectType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of Datasource object, used to initialize the right inherited type.""" + resource_id: str = rest_field(name="resourceID", visibility=["read", "create", "update", "delete", "query"]) + """Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this + will be the ID created by backup service via Fabric/Vault. Required.""" + resource_location: Optional[str] = rest_field( + name="resourceLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Location of datasource.""" + resource_name: Optional[str] = rest_field( + name="resourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """Unique identifier of the resource in the context of parent.""" + resource_type: Optional[str] = rest_field( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Type of Datasource.""" + resource_uri: Optional[str] = rest_field( + name="resourceUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Uri of the resource.""" + resource_properties: Optional["_models.BaseResourceProperties"] = rest_field( + name="resourceProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties specific to data source set.""" + + @overload + def __init__( + self, + *, + resource_id: str, + datasource_type: Optional[str] = None, + object_type: Optional[str] = None, + resource_location: Optional[str] = None, + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + resource_uri: Optional[str] = None, + resource_properties: Optional["_models.BaseResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataStoreInfoBase(_Model): + """DataStoreInfo base. + + :ivar data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values + are: "OperationalStore", "VaultStore", and "ArchiveStore". + :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + Required. + :vartype object_type: str + """ + + data_store_type: Union[str, "_models.DataStoreTypes"] = rest_field( + name="dataStoreType", visibility=["read", "create", "update", "delete", "query"] + ) + """type of datastore; Operational/Vault/Archive. Required. Known values are: \"OperationalStore\", + \"VaultStore\", and \"ArchiveStore\".""" + object_type: str = rest_field(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of Datasource object, used to initialize the right inherited type. Required.""" + + @overload + def __init__( + self, + *, + data_store_type: Union[str, "_models.DataStoreTypes"], + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Day(_Model): + """Day of the week. + + :ivar date: Date of the month. + :vartype date: int + :ivar is_last: Whether Date is last date of month. + :vartype is_last: bool + """ + + date: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Date of the month.""" + is_last: Optional[bool] = rest_field(name="isLast", visibility=["read", "create", "update", "delete", "query"]) + """Whether Date is last date of month.""" + + @overload + def __init__( + self, + *, + date: Optional[int] = None, + is_last: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DefaultResourceProperties(BaseResourceProperties, discriminator="DefaultResourceProperties"): + """Default source properties. + + :ivar object_type: Type of the specific object - used for deserializing. Required. + :vartype object_type: str or ~azure.mgmt.dataprotection.models.DEFAULT_RESOURCE_PROPERTIES + """ + + object_type: Literal[ResourcePropertiesObjectType.DEFAULT_RESOURCE_PROPERTIES] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = ResourcePropertiesObjectType.DEFAULT_RESOURCE_PROPERTIES # type: ignore + + +class DeletedBackupInstance(BackupInstance): + """Deleted Backup Instance. + + :ivar friendly_name: Gets or sets the Backup Instance friendly name. + :vartype friendly_name: str + :ivar data_source_info: Gets or sets the data source information. Required. + :vartype data_source_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar data_source_set_info: Gets or sets the data source set information. + :vartype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar policy_info: Gets or sets the policy information. Required. + :vartype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar protection_status: Specifies the protection status of the resource. + :vartype protection_status: ~azure.mgmt.dataprotection.models.ProtectionStatusDetails + :ivar current_protection_state: Specifies the current protection state of the resource. Known + values are: "Invalid", "NotProtected", "ConfiguringProtection", "ProtectionConfigured", + "BackupSchedulesSuspended", "RetentionSchedulesSuspended", "ProtectionStopped", + "ProtectionError", "ConfiguringProtectionFailed", "SoftDeleting", "SoftDeleted", and + "UpdatingProtection". + :vartype current_protection_state: str or + ~azure.mgmt.dataprotection.models.CurrentProtectionState + :ivar protection_error_details: Specifies the protection error of the resource. + :vartype protection_error_details: ~azure.mgmt.dataprotection.models.UserFacingError + :ivar provisioning_state: Specifies the provisioning state of the resource i.e. + provisioning/updating/Succeeded/Failed. + :vartype provisioning_state: str + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :ivar validation_type: Specifies the type of validation. In case of DeepValidation, all + validations from /validateForBackup API will run again. Known values are: "ShallowValidation" + and "DeepValidation". + :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType + :ivar identity_details: Contains information of the Identity Details for the BI. + If it is null, default will be considered as System Assigned. + :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails + :ivar object_type: Required. + :vartype object_type: str + :ivar deletion_info: Deletion info of Backup Instance. + :vartype deletion_info: ~azure.mgmt.dataprotection.models.DeletionInfo + """ + + deletion_info: Optional["_models.DeletionInfo"] = rest_field(name="deletionInfo", visibility=["read"]) + """Deletion info of Backup Instance.""" + + @overload + def __init__( + self, + *, + data_source_info: "_models.Datasource", + policy_info: "_models.PolicyInfo", + object_type: str, + friendly_name: Optional[str] = None, + data_source_set_info: Optional["_models.DatasourceSet"] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, + validation_type: Optional[Union[str, "_models.ValidationType"]] = None, + identity_details: Optional["_models.IdentityDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedBackupInstanceResource(ProxyResource): + """Deleted Backup Instance. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: DeletedBackupInstanceResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.DeletedBackupInstance + """ + + properties: Optional["_models.DeletedBackupInstance"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """DeletedBackupInstanceResource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DeletedBackupInstance"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletionInfo(_Model): + """Deletion Info. + + :ivar deletion_time: Specifies time of deletion. + :vartype deletion_time: str + :ivar billing_end_date: Specifies billing end date. + :vartype billing_end_date: str + :ivar scheduled_purge_time: Specifies purge time. + :vartype scheduled_purge_time: str + :ivar delete_activity_id: Delete activity ID for troubleshooting purpose. + :vartype delete_activity_id: str + """ + + deletion_time: Optional[str] = rest_field(name="deletionTime", visibility=["read"]) + """Specifies time of deletion.""" + billing_end_date: Optional[str] = rest_field(name="billingEndDate", visibility=["read"]) + """Specifies billing end date.""" + scheduled_purge_time: Optional[str] = rest_field(name="scheduledPurgeTime", visibility=["read"]) + """Specifies purge time.""" + delete_activity_id: Optional[str] = rest_field(name="deleteActivityID", visibility=["read"]) + """Delete activity ID for troubleshooting purpose.""" + + +class DppBaseResource(ProxyResource): + """Base resource under Microsoft.DataProtection provider namespace. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + """ + + +class DppIdentityDetails(_Model): + """Identity details. + + :ivar principal_id: The object ID of the service principal object for the managed identity that + is used to grant role-based access to an Azure resource. + :vartype principal_id: str + :ivar tenant_id: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where + the resource is now a member. + :vartype tenant_id: str + :ivar type: The identityType which can be either SystemAssigned, UserAssigned, + 'SystemAssigned,UserAssigned' or None. + :vartype type: str + :ivar user_assigned_identities: Gets or sets the user assigned identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.dataprotection.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The object ID of the service principal object for the managed identity that is used to grant + role-based access to an Azure resource.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is + now a member.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identityType which can be either SystemAssigned, UserAssigned, + 'SystemAssigned,UserAssigned' or None.""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the user assigned identities.""" + + @overload + def __init__( + self, + *, + type: Optional[str] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DppResourceList(_Model): + """ListResource. + + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str + """ + + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The uri to fetch the next page of resources. Call ListNext() fetches next page of resources.""" + + @overload + def __init__( + self, + *, + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DppTrackedResourceList(_Model): + """DppTrackedResourceList. + + :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page + of resources. + :vartype next_link: str + """ + + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The uri to fetch the next page of resources. Call ListNext() fetches next page of resources.""" + + @overload + def __init__( + self, + *, + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionSettings(_Model): + """Customer Managed Key details of the resource. + + :ivar state: Encryption state of the Backup Vault. Known values are: "Enabled", "Disabled", and + "Inconsistent". + :vartype state: str or ~azure.mgmt.dataprotection.models.EncryptionState + :ivar key_vault_properties: The properties of the Key Vault which hosts CMK. + :vartype key_vault_properties: ~azure.mgmt.dataprotection.models.CmkKeyVaultProperties + :ivar kek_identity: The details of the managed identity used for CMK. + :vartype kek_identity: ~azure.mgmt.dataprotection.models.CmkKekIdentity + :ivar infrastructure_encryption: Enabling/Disabling the Double Encryption state. Known values + are: "Enabled" and "Disabled". + :vartype infrastructure_encryption: str or + ~azure.mgmt.dataprotection.models.InfrastructureEncryptionState + """ + + state: Optional[Union[str, "_models.EncryptionState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption state of the Backup Vault. Known values are: \"Enabled\", \"Disabled\", and + \"Inconsistent\".""" + key_vault_properties: Optional["_models.CmkKeyVaultProperties"] = rest_field( + name="keyVaultProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the Key Vault which hosts CMK.""" + kek_identity: Optional["_models.CmkKekIdentity"] = rest_field( + name="kekIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The details of the managed identity used for CMK.""" + infrastructure_encryption: Optional[Union[str, "_models.InfrastructureEncryptionState"]] = rest_field( + name="infrastructureEncryption", visibility=["read", "create", "update", "delete", "query"] + ) + """Enabling/Disabling the Double Encryption state. Known values are: \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.EncryptionState"]] = None, + key_vault_properties: Optional["_models.CmkKeyVaultProperties"] = None, + kek_identity: Optional["_models.CmkKekIdentity"] = None, + infrastructure_encryption: Optional[Union[str, "_models.InfrastructureEncryptionState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Error(_Model): + """The resource management error response. + + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.dataprotection.models.ErrorAdditionalInfo] + :ivar code: The error code. + :vartype code: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.dataprotection.models.Error] + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + """ + + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + details: Optional[list["_models.Error"]] = rest_field(visibility=["read"]) + """The error details.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.dataprotection.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.dataprotection.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.dataprotection.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExportJobsResult(_Model): + """The result for export jobs containing blob details. + + :ivar blob_url: URL of the blob into which the serialized string of list of jobs is exported. + :vartype blob_url: str + :ivar blob_sas_key: SAS key to access the blob. + :vartype blob_sas_key: str + :ivar excel_file_blob_url: URL of the blob into which the ExcelFile is uploaded. + :vartype excel_file_blob_url: str + :ivar excel_file_blob_sas_key: SAS key to access the ExcelFile blob. + :vartype excel_file_blob_sas_key: str + """ + + blob_url: Optional[str] = rest_field(name="blobUrl", visibility=["read"]) + """URL of the blob into which the serialized string of list of jobs is exported.""" + blob_sas_key: Optional[str] = rest_field(name="blobSasKey", visibility=["read"]) + """SAS key to access the blob.""" + excel_file_blob_url: Optional[str] = rest_field(name="excelFileBlobUrl", visibility=["read"]) + """URL of the blob into which the ExcelFile is uploaded.""" + excel_file_blob_sas_key: Optional[str] = rest_field(name="excelFileBlobSasKey", visibility=["read"]) + """SAS key to access the ExcelFile blob.""" + + +class FeatureSettings(_Model): + """Class containing feature settings of vault. + + :ivar cross_subscription_restore_settings: CrossSubscriptionRestore Settings. + :vartype cross_subscription_restore_settings: + ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings + :ivar cross_region_restore_settings: + :vartype cross_region_restore_settings: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreSettings + """ + + cross_subscription_restore_settings: Optional["_models.CrossSubscriptionRestoreSettings"] = rest_field( + name="crossSubscriptionRestoreSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """CrossSubscriptionRestore Settings.""" + cross_region_restore_settings: Optional["_models.CrossRegionRestoreSettings"] = rest_field( + name="crossRegionRestoreSettings", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + cross_subscription_restore_settings: Optional["_models.CrossSubscriptionRestoreSettings"] = None, + cross_region_restore_settings: Optional["_models.CrossRegionRestoreSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FeatureValidationRequestBase(_Model): + """Base class for Backup Feature support. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FeatureValidationRequest + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FeatureValidationRequest(FeatureValidationRequestBase, discriminator="FeatureValidationRequest"): + """Base class for feature object. + + :ivar feature_type: backup support feature type. Known values are: "Invalid" and + "DataSourceType". + :vartype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType + :ivar feature_name: backup support feature name. + :vartype feature_name: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "FeatureValidationRequest". + :vartype object_type: str + """ + + feature_type: Optional[Union[str, "_models.FeatureType"]] = rest_field( + name="featureType", visibility=["read", "create", "update", "delete", "query"] + ) + """backup support feature type. Known values are: \"Invalid\" and \"DataSourceType\".""" + feature_name: Optional[str] = rest_field( + name="featureName", visibility=["read", "create", "update", "delete", "query"] + ) + """backup support feature name.""" + object_type: Literal["FeatureValidationRequest"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"FeatureValidationRequest\".""" + + @overload + def __init__( + self, + *, + feature_type: Optional[Union[str, "_models.FeatureType"]] = None, + feature_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "FeatureValidationRequest" # type: ignore + + +class FeatureValidationResponseBase(_Model): + """Base class for Backup Feature support. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FeatureValidationResponse + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FeatureValidationResponse(FeatureValidationResponseBase, discriminator="FeatureValidationResponse"): + """Feature Validation Response. + + :ivar feature_type: backup support feature type. Known values are: "Invalid" and + "DataSourceType". + :vartype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType + :ivar features: Response features. + :vartype features: list[~azure.mgmt.dataprotection.models.SupportedFeature] + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "FeatureValidationResponse". + :vartype object_type: str + """ + + feature_type: Optional[Union[str, "_models.FeatureType"]] = rest_field( + name="featureType", visibility=["read", "create", "update", "delete", "query"] + ) + """backup support feature type. Known values are: \"Invalid\" and \"DataSourceType\".""" + features: Optional[list["_models.SupportedFeature"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Response features.""" + object_type: Literal["FeatureValidationResponse"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"FeatureValidationResponse\".""" + + @overload + def __init__( + self, + *, + feature_type: Optional[Union[str, "_models.FeatureType"]] = None, + features: Optional[list["_models.SupportedFeature"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "FeatureValidationResponse" # type: ignore + + +class FetchSecondaryRPsRequestParameters(_Model): + """Information about BI whose secondary RecoveryPoints are requested + Source region and + BI ARM path. + + :ivar source_region: Source region in which BackupInstance is located. + :vartype source_region: str + :ivar source_backup_instance_id: ARM Path of BackupInstance. + :vartype source_backup_instance_id: str + """ + + source_region: Optional[str] = rest_field( + name="sourceRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """Source region in which BackupInstance is located.""" + source_backup_instance_id: Optional[str] = rest_field( + name="sourceBackupInstanceId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM Path of BackupInstance.""" + + @overload + def __init__( + self, + *, + source_region: Optional[str] = None, + source_backup_instance_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IdentityDetails(_Model): + """IdentityDetails. + + :ivar use_system_assigned_identity: Specifies if the BI is protected by System Identity. + :vartype use_system_assigned_identity: bool + :ivar user_assigned_identity_arm_url: ARM URL for User Assigned Identity. + :vartype user_assigned_identity_arm_url: str + """ + + use_system_assigned_identity: Optional[bool] = rest_field( + name="useSystemAssignedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies if the BI is protected by System Identity.""" + user_assigned_identity_arm_url: Optional[str] = rest_field( + name="userAssignedIdentityArmUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM URL for User Assigned Identity.""" + + @overload + def __init__( + self, + *, + use_system_assigned_identity: Optional[bool] = None, + user_assigned_identity_arm_url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImmediateCopyOption(CopyOption, discriminator="ImmediateCopyOption"): + """Immediate copy Option. + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "ImmediateCopyOption". + :vartype object_type: str + """ + + object_type: Literal["ImmediateCopyOption"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"ImmediateCopyOption\".""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "ImmediateCopyOption" # type: ignore + + +class ImmutabilitySettings(_Model): + """Immutability Settings at vault level. + + :ivar state: Immutability state. Known values are: "Disabled", "Unlocked", and "Locked". + :vartype state: str or ~azure.mgmt.dataprotection.models.ImmutabilityState + """ + + state: Optional[Union[str, "_models.ImmutabilityState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Immutability state. Known values are: \"Disabled\", \"Unlocked\", and \"Locked\".""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.ImmutabilityState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InnerError(_Model): + """Inner Error. + + :ivar additional_info: Any Key value pairs that can be provided to the client for additional + verbose information. + :vartype additional_info: dict[str, str] + :ivar code: Unique code for this error. + :vartype code: str + :ivar embedded_inner_error: Child Inner Error, to allow Nesting. + :vartype embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError + """ + + additional_info: Optional[dict[str, str]] = rest_field( + name="additionalInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Any Key value pairs that can be provided to the client for additional verbose information.""" + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique code for this error.""" + embedded_inner_error: Optional["_models.InnerError"] = rest_field( + name="embeddedInnerError", visibility=["read", "create", "update", "delete", "query"] + ) + """Child Inner Error, to allow Nesting.""" + + @overload + def __init__( + self, + *, + additional_info: Optional[dict[str, str]] = None, + code: Optional[str] = None, + embedded_inner_error: Optional["_models.InnerError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ItemLevelRestoreCriteria(_Model): + """Class to contain criteria for item level restore. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ItemPathBasedRestoreCriteria, KubernetesClusterRestoreCriteria, + KubernetesClusterVaultTierRestoreCriteria, KubernetesPVRestoreCriteria, + KubernetesStorageClassRestoreCriteria, RangeBasedItemLevelRestoreCriteria + + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of the specific object - used for deserializing. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestoreTargetInfoBase(_Model): + """Base class common to RestoreTargetInfo and RestoreFilesTargetInfo. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ItemLevelRestoreTargetInfo, RestoreFilesTargetInfo, RestoreTargetInfo + + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + Required. Default value is None. + :vartype object_type: str + :ivar recovery_option: Recovery Option. Required. "FailIfExists" + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """Type of Datasource object, used to initialize the right inherited type. Required. Default value + is None.""" + recovery_option: Union[str, "_models.RecoveryOption"] = rest_field( + name="recoveryOption", visibility=["read", "create", "update", "delete", "query"] + ) + """Recovery Option. Required. \"FailIfExists\"""" + restore_location: Optional[str] = rest_field( + name="restoreLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """Target Restore region.""" + + @overload + def __init__( + self, + *, + object_type: str, + recovery_option: Union[str, "_models.RecoveryOption"], + restore_location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ItemLevelRestoreTargetInfo(RestoreTargetInfoBase, discriminator="ItemLevelRestoreTargetInfo"): + """Restore target info for Item level restore operation. + + :ivar recovery_option: Recovery Option. Required. "FailIfExists" + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + :ivar restore_criteria: Restore Criteria. Required. + :vartype restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] + :ivar datasource_info: Information of target DS. Required. + :vartype datasource_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar datasource_set_info: Information of target DS Set. + :vartype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + Required. Default value is "ItemLevelRestoreTargetInfo". + :vartype object_type: str + """ + + restore_criteria: list["_models.ItemLevelRestoreCriteria"] = rest_field( + name="restoreCriteria", visibility=["read", "create", "update", "delete", "query"] + ) + """Restore Criteria. Required.""" + datasource_info: "_models.Datasource" = rest_field( + name="datasourceInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Information of target DS. Required.""" + datasource_set_info: Optional["_models.DatasourceSet"] = rest_field( + name="datasourceSetInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Information of target DS Set.""" + datasource_auth_credentials: Optional["_models.AuthCredentials"] = rest_field( + name="datasourceAuthCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """Credentials to use to authenticate with data source provider.""" + object_type: Literal["ItemLevelRestoreTargetInfo"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of Datasource object, used to initialize the right inherited type. Required. Default value + is \"ItemLevelRestoreTargetInfo\".""" + + @overload + def __init__( + self, + *, + recovery_option: Union[str, "_models.RecoveryOption"], + restore_criteria: list["_models.ItemLevelRestoreCriteria"], + datasource_info: "_models.Datasource", + restore_location: Optional[str] = None, + datasource_set_info: Optional["_models.DatasourceSet"] = None, + datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "ItemLevelRestoreTargetInfo" # type: ignore + + +class ItemPathBasedRestoreCriteria(ItemLevelRestoreCriteria, discriminator="ItemPathBasedRestoreCriteria"): + """Prefix criteria to be used to during restore. + + :ivar item_path: The path of the item to be restored. It could be the full path of the item or + the path relative to the backup item. Required. + :vartype item_path: str + :ivar is_path_relative_to_backup_item: Flag to specify if the path is relative to backup item + or full path. Required. + :vartype is_path_relative_to_backup_item: bool + :ivar sub_item_path_prefix: The list of prefix strings to be used as filter criteria during + restore. These are relative to the item path specified. + :vartype sub_item_path_prefix: list[str] + :ivar rename_to: Rename the item to be restored. Restore will rename the itemPath to this new + name if the value is specified otherwise the itemPath will be restored as same name. + :vartype rename_to: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "ItemPathBasedRestoreCriteria". + :vartype object_type: str + """ + + item_path: str = rest_field(name="itemPath", visibility=["read", "create", "update", "delete", "query"]) + """The path of the item to be restored. It could be the full path of the item or the path relative + to the backup item. Required.""" + is_path_relative_to_backup_item: bool = rest_field( + name="isPathRelativeToBackupItem", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to specify if the path is relative to backup item or full path. Required.""" + sub_item_path_prefix: Optional[list[str]] = rest_field( + name="subItemPathPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of prefix strings to be used as filter criteria during restore. These are relative to + the item path specified.""" + rename_to: Optional[str] = rest_field(name="renameTo", visibility=["read", "create", "update", "delete", "query"]) + """Rename the item to be restored. Restore will rename the itemPath to this new name if the value + is specified otherwise the itemPath will be restored as same name.""" + object_type: Literal["ItemPathBasedRestoreCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"ItemPathBasedRestoreCriteria\".""" + + @overload + def __init__( + self, + *, + item_path: str, + is_path_relative_to_backup_item: bool, + sub_item_path_prefix: Optional[list[str]] = None, + rename_to: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "ItemPathBasedRestoreCriteria" # type: ignore + + +class JobExtendedInfo(_Model): + """Extended Information about the job. + + :ivar additional_details: Job's Additional Details. + :vartype additional_details: dict[str, str] + :ivar backup_instance_state: State of the Backup Instance. + :vartype backup_instance_state: str + :ivar data_transferred_in_bytes: Number of bytes transferred. + :vartype data_transferred_in_bytes: float + :ivar recovery_destination: Destination where restore is done. + :vartype recovery_destination: str + :ivar source_recover_point: Details of the Source Recovery Point. + :vartype source_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails + :ivar sub_tasks: List of Sub Tasks of the job. + :vartype sub_tasks: list[~azure.mgmt.dataprotection.models.JobSubTask] + :ivar target_recover_point: Details of the Target Recovery Point. + :vartype target_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails + :ivar warning_details: A List, detailing the warnings related to the job. + :vartype warning_details: list[~azure.mgmt.dataprotection.models.UserFacingWarningDetail] + """ + + additional_details: Optional[dict[str, str]] = rest_field( + name="additionalDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Job's Additional Details.""" + backup_instance_state: Optional[str] = rest_field(name="backupInstanceState", visibility=["read"]) + """State of the Backup Instance.""" + data_transferred_in_bytes: Optional[float] = rest_field(name="dataTransferredInBytes", visibility=["read"]) + """Number of bytes transferred.""" + recovery_destination: Optional[str] = rest_field(name="recoveryDestination", visibility=["read"]) + """Destination where restore is done.""" + source_recover_point: Optional["_models.RestoreJobRecoveryPointDetails"] = rest_field( + name="sourceRecoverPoint", visibility=["read"] + ) + """Details of the Source Recovery Point.""" + sub_tasks: Optional[list["_models.JobSubTask"]] = rest_field(name="subTasks", visibility=["read"]) + """List of Sub Tasks of the job.""" + target_recover_point: Optional["_models.RestoreJobRecoveryPointDetails"] = rest_field( + name="targetRecoverPoint", visibility=["read"] + ) + """Details of the Target Recovery Point.""" + warning_details: Optional[list["_models.UserFacingWarningDetail"]] = rest_field( + name="warningDetails", visibility=["read"] + ) + """A List, detailing the warnings related to the job.""" + + @overload + def __init__( + self, + *, + additional_details: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class JobSubTask(_Model): + """Details of Job's Sub Task. + + :ivar additional_details: Additional details of Sub Tasks. + :vartype additional_details: dict[str, str] + :ivar task_id: Task Id of the Sub Task. Required. + :vartype task_id: int + :ivar task_name: Name of the Sub Task. Required. + :vartype task_name: str + :ivar task_progress: Progress of the Sub Task. + :vartype task_progress: str + :ivar task_status: Status of the Sub Task. Required. + :vartype task_status: str + """ + + additional_details: Optional[dict[str, str]] = rest_field( + name="additionalDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional details of Sub Tasks.""" + task_id: int = rest_field(name="taskId", visibility=["read", "create", "update", "delete", "query"]) + """Task Id of the Sub Task. Required.""" + task_name: str = rest_field(name="taskName", visibility=["read", "create", "update", "delete", "query"]) + """Name of the Sub Task. Required.""" + task_progress: Optional[str] = rest_field(name="taskProgress", visibility=["read"]) + """Progress of the Sub Task.""" + task_status: str = rest_field(name="taskStatus", visibility=["read", "create", "update", "delete", "query"]) + """Status of the Sub Task. Required.""" + + @overload + def __init__( + self, + *, + task_id: int, + task_name: str, + task_status: str, + additional_details: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KubernetesClusterBackupDatasourceParameters( + BackupDatasourceParameters, discriminator="KubernetesClusterBackupDatasourceParameters" +): # pylint: disable=name-too-long + """Parameters for Kubernetes Cluster Backup Datasource. + + :ivar snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled + will take volume snapshots during backup. Required. + :vartype snapshot_volumes: bool + :ivar included_volume_types: Gets or sets the include volume types property. This property sets + the volume types to be included during backup. + :vartype included_volume_types: list[str or ~azure.mgmt.dataprotection.models.AKSVolumeTypes] + :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. + This property if enabled will include cluster scope resources during backup. Required. + :vartype include_cluster_scope_resources: bool + :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the + namespaces to be included during backup. + :vartype included_namespaces: list[str] + :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the + namespaces to be excluded during backup. + :vartype excluded_namespaces: list[str] + :ivar included_resource_types: Gets or sets the include resource types property. This property + sets the resource types to be included during backup. + :vartype included_resource_types: list[str] + :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property + sets the resource types to be excluded during backup. + :vartype excluded_resource_types: list[str] + :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the + resource with such label selectors to be included during backup. + :vartype label_selectors: list[str] + :ivar backup_hook_references: Gets or sets the backup hook references. This property sets the + hook reference to be executed during backup. + :vartype backup_hook_references: list[~azure.mgmt.dataprotection.models.NamespacedNameResource] + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "KubernetesClusterBackupDatasourceParameters". + :vartype object_type: str + """ + + snapshot_volumes: bool = rest_field( + name="snapshotVolumes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the volume snapshot property. This property if enabled will take volume snapshots + during backup. Required.""" + included_volume_types: Optional[list[Union[str, "_models.AKSVolumeTypes"]]] = rest_field( + name="includedVolumeTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include volume types property. This property sets the volume types to be + included during backup.""" + include_cluster_scope_resources: bool = rest_field( + name="includeClusterScopeResources", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include cluster resources property. This property if enabled will include + cluster scope resources during backup. Required.""" + included_namespaces: Optional[list[str]] = rest_field( + name="includedNamespaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include namespaces property. This property sets the namespaces to be included + during backup.""" + excluded_namespaces: Optional[list[str]] = rest_field( + name="excludedNamespaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded + during backup.""" + included_resource_types: Optional[list[str]] = rest_field( + name="includedResourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include resource types property. This property sets the resource types to be + included during backup.""" + excluded_resource_types: Optional[list[str]] = rest_field( + name="excludedResourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the exclude resource types property. This property sets the resource types to be + excluded during backup.""" + label_selectors: Optional[list[str]] = rest_field( + name="labelSelectors", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the LabelSelectors property. This property sets the resource with such label + selectors to be included during backup.""" + backup_hook_references: Optional[list["_models.NamespacedNameResource"]] = rest_field( + name="backupHookReferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the backup hook references. This property sets the hook reference to be executed + during backup.""" + object_type: Literal["KubernetesClusterBackupDatasourceParameters"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"KubernetesClusterBackupDatasourceParameters\".""" + + @overload + def __init__( + self, + *, + snapshot_volumes: bool, + include_cluster_scope_resources: bool, + included_volume_types: Optional[list[Union[str, "_models.AKSVolumeTypes"]]] = None, + included_namespaces: Optional[list[str]] = None, + excluded_namespaces: Optional[list[str]] = None, + included_resource_types: Optional[list[str]] = None, + excluded_resource_types: Optional[list[str]] = None, + label_selectors: Optional[list[str]] = None, + backup_hook_references: Optional[list["_models.NamespacedNameResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "KubernetesClusterBackupDatasourceParameters" # type: ignore + + +class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria, discriminator="KubernetesClusterRestoreCriteria"): + """kubernetes Cluster Backup target info for restore operation. + + :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. + This property if enabled will include cluster scope resources during restore. Required. + :vartype include_cluster_scope_resources: bool + :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the + namespaces to be included during restore. + :vartype included_namespaces: list[str] + :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the + namespaces to be excluded during restore. + :vartype excluded_namespaces: list[str] + :ivar included_resource_types: Gets or sets the include resource types property. This property + sets the resource types to be included during restore. + :vartype included_resource_types: list[str] + :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property + sets the resource types to be excluded during restore. + :vartype excluded_resource_types: list[str] + :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the + resource with such label selectors to be included during restore. + :vartype label_selectors: list[str] + :ivar persistent_volume_restore_mode: Gets or sets the PV (Persistent Volume) Restore Mode + property. This property sets whether volumes needs to be restored. Known values are: + "RestoreWithVolumeData" and "RestoreWithoutVolumeData". + :vartype persistent_volume_restore_mode: str or + ~azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode + :ivar conflict_policy: Gets or sets the Conflict Policy property. This property sets policy + during conflict of resources during restore. Known values are: "Skip" and "Patch". + :vartype conflict_policy: str or ~azure.mgmt.dataprotection.models.ExistingResourcePolicy + :ivar namespace_mappings: Gets or sets the Namespace Mappings property. This property sets if + namespace needs to be change during restore. + :vartype namespace_mappings: dict[str, str] + :ivar restore_hook_references: Gets or sets the restore hook references. This property sets the + hook reference to be executed during restore. + :vartype restore_hook_references: + list[~azure.mgmt.dataprotection.models.NamespacedNameResource] + :ivar resource_modifier_reference: Gets or sets the resource modifier reference. This property + sets the reference for resource modifier during restore. + :vartype resource_modifier_reference: ~azure.mgmt.dataprotection.models.NamespacedNameResource + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "KubernetesClusterRestoreCriteria". + :vartype object_type: str + """ + + include_cluster_scope_resources: bool = rest_field( + name="includeClusterScopeResources", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include cluster resources property. This property if enabled will include + cluster scope resources during restore. Required.""" + included_namespaces: Optional[list[str]] = rest_field( + name="includedNamespaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include namespaces property. This property sets the namespaces to be included + during restore.""" + excluded_namespaces: Optional[list[str]] = rest_field( + name="excludedNamespaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded + during restore.""" + included_resource_types: Optional[list[str]] = rest_field( + name="includedResourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include resource types property. This property sets the resource types to be + included during restore.""" + excluded_resource_types: Optional[list[str]] = rest_field( + name="excludedResourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the exclude resource types property. This property sets the resource types to be + excluded during restore.""" + label_selectors: Optional[list[str]] = rest_field( + name="labelSelectors", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the LabelSelectors property. This property sets the resource with such label + selectors to be included during restore.""" + persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = rest_field( + name="persistentVolumeRestoreMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether + volumes needs to be restored. Known values are: \"RestoreWithVolumeData\" and + \"RestoreWithoutVolumeData\".""" + conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = rest_field( + name="conflictPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Conflict Policy property. This property sets policy during conflict of + resources during restore. Known values are: \"Skip\" and \"Patch\".""" + namespace_mappings: Optional[dict[str, str]] = rest_field( + name="namespaceMappings", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Namespace Mappings property. This property sets if namespace needs to be + change during restore.""" + restore_hook_references: Optional[list["_models.NamespacedNameResource"]] = rest_field( + name="restoreHookReferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the restore hook references. This property sets the hook reference to be executed + during restore.""" + resource_modifier_reference: Optional["_models.NamespacedNameResource"] = rest_field( + name="resourceModifierReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the resource modifier reference. This property sets the reference for resource + modifier during restore.""" + object_type: Literal["KubernetesClusterRestoreCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"KubernetesClusterRestoreCriteria\".""" + + @overload + def __init__( + self, + *, + include_cluster_scope_resources: bool, + included_namespaces: Optional[list[str]] = None, + excluded_namespaces: Optional[list[str]] = None, + included_resource_types: Optional[list[str]] = None, + excluded_resource_types: Optional[list[str]] = None, + label_selectors: Optional[list[str]] = None, + persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = None, + conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = None, + namespace_mappings: Optional[dict[str, str]] = None, + restore_hook_references: Optional[list["_models.NamespacedNameResource"]] = None, + resource_modifier_reference: Optional["_models.NamespacedNameResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "KubernetesClusterRestoreCriteria" # type: ignore + + +class KubernetesClusterVaultTierRestoreCriteria( + ItemLevelRestoreCriteria, discriminator="KubernetesClusterVaultTierRestoreCriteria" +): # pylint: disable=name-too-long + """kubernetes Cluster Backup target info for restore operation from vault. + + :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. + This property if enabled will include cluster scope resources during restore from vault. + Required. + :vartype include_cluster_scope_resources: bool + :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the + namespaces to be included during restore from vault. + :vartype included_namespaces: list[str] + :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the + namespaces to be excluded during restore from vault. + :vartype excluded_namespaces: list[str] + :ivar included_resource_types: Gets or sets the include resource types property. This property + sets the resource types to be included during restore from vault. + :vartype included_resource_types: list[str] + :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property + sets the resource types to be excluded during restore from vault. + :vartype excluded_resource_types: list[str] + :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the + resource with such label selectors to be included during restore from vault. + :vartype label_selectors: list[str] + :ivar persistent_volume_restore_mode: Gets or sets the PV (Persistent Volume) Restore Mode + property. This property sets whether volumes needs to be restored from vault. Known values are: + "RestoreWithVolumeData" and "RestoreWithoutVolumeData". + :vartype persistent_volume_restore_mode: str or + ~azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode + :ivar conflict_policy: Gets or sets the Conflict Policy property. This property sets policy + during conflict of resources during restore from vault. Known values are: "Skip" and "Patch". + :vartype conflict_policy: str or ~azure.mgmt.dataprotection.models.ExistingResourcePolicy + :ivar namespace_mappings: Gets or sets the Namespace Mappings property. This property sets if + namespace needs to be change during restore from vault. + :vartype namespace_mappings: dict[str, str] + :ivar restore_hook_references: Gets or sets the restore hook references. This property sets the + hook reference to be executed during restore from vault. + :vartype restore_hook_references: + list[~azure.mgmt.dataprotection.models.NamespacedNameResource] + :ivar staging_resource_group_id: Gets or sets the staging RG Id for creating staging disks and + snapshots during restore from vault. + :vartype staging_resource_group_id: str + :ivar staging_storage_account_id: Gets or sets the staging Storage Account Id for creating + backup extension object store data during restore from vault. + :vartype staging_storage_account_id: str + :ivar resource_modifier_reference: Gets or sets the resource modifier reference. This property + sets the reference for resource modifier during restore. + :vartype resource_modifier_reference: ~azure.mgmt.dataprotection.models.NamespacedNameResource + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "KubernetesClusterVaultTierRestoreCriteria". + :vartype object_type: str + """ + + include_cluster_scope_resources: bool = rest_field( + name="includeClusterScopeResources", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include cluster resources property. This property if enabled will include + cluster scope resources during restore from vault. Required.""" + included_namespaces: Optional[list[str]] = rest_field( + name="includedNamespaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include namespaces property. This property sets the namespaces to be included + during restore from vault.""" + excluded_namespaces: Optional[list[str]] = rest_field( + name="excludedNamespaces", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded + during restore from vault.""" + included_resource_types: Optional[list[str]] = rest_field( + name="includedResourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the include resource types property. This property sets the resource types to be + included during restore from vault.""" + excluded_resource_types: Optional[list[str]] = rest_field( + name="excludedResourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the exclude resource types property. This property sets the resource types to be + excluded during restore from vault.""" + label_selectors: Optional[list[str]] = rest_field( + name="labelSelectors", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the LabelSelectors property. This property sets the resource with such label + selectors to be included during restore from vault.""" + persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = rest_field( + name="persistentVolumeRestoreMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether + volumes needs to be restored from vault. Known values are: \"RestoreWithVolumeData\" and + \"RestoreWithoutVolumeData\".""" + conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = rest_field( + name="conflictPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Conflict Policy property. This property sets policy during conflict of + resources during restore from vault. Known values are: \"Skip\" and \"Patch\".""" + namespace_mappings: Optional[dict[str, str]] = rest_field( + name="namespaceMappings", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Namespace Mappings property. This property sets if namespace needs to be + change during restore from vault.""" + restore_hook_references: Optional[list["_models.NamespacedNameResource"]] = rest_field( + name="restoreHookReferences", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the restore hook references. This property sets the hook reference to be executed + during restore from vault.""" + staging_resource_group_id: Optional[str] = rest_field( + name="stagingResourceGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the staging RG Id for creating staging disks and snapshots during restore from + vault.""" + staging_storage_account_id: Optional[str] = rest_field( + name="stagingStorageAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the staging Storage Account Id for creating backup extension object store data + during restore from vault.""" + resource_modifier_reference: Optional["_models.NamespacedNameResource"] = rest_field( + name="resourceModifierReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the resource modifier reference. This property sets the reference for resource + modifier during restore.""" + object_type: Literal["KubernetesClusterVaultTierRestoreCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"KubernetesClusterVaultTierRestoreCriteria\".""" + + @overload + def __init__( + self, + *, + include_cluster_scope_resources: bool, + included_namespaces: Optional[list[str]] = None, + excluded_namespaces: Optional[list[str]] = None, + included_resource_types: Optional[list[str]] = None, + excluded_resource_types: Optional[list[str]] = None, + label_selectors: Optional[list[str]] = None, + persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = None, + conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = None, + namespace_mappings: Optional[dict[str, str]] = None, + restore_hook_references: Optional[list["_models.NamespacedNameResource"]] = None, + staging_resource_group_id: Optional[str] = None, + staging_storage_account_id: Optional[str] = None, + resource_modifier_reference: Optional["_models.NamespacedNameResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "KubernetesClusterVaultTierRestoreCriteria" # type: ignore + + +class KubernetesPVRestoreCriteria(ItemLevelRestoreCriteria, discriminator="KubernetesPVRestoreCriteria"): + """Item Level kubernetes persistent volume target info for restore operation. + + :ivar name: Selected persistent volume claim name. + :vartype name: str + :ivar storage_class_name: Selected storage class name for restore operation. + :vartype storage_class_name: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "KubernetesPVRestoreCriteria". + :vartype object_type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Selected persistent volume claim name.""" + storage_class_name: Optional[str] = rest_field( + name="storageClassName", visibility=["read", "create", "update", "delete", "query"] + ) + """Selected storage class name for restore operation.""" + object_type: Literal["KubernetesPVRestoreCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"KubernetesPVRestoreCriteria\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + storage_class_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "KubernetesPVRestoreCriteria" # type: ignore + + +class KubernetesStorageClassRestoreCriteria( + ItemLevelRestoreCriteria, discriminator="KubernetesStorageClassRestoreCriteria" +): + """Item Level kubernetes storage class target info for restore operation. + + :ivar selected_storage_class_name: Selected storage class name. + :vartype selected_storage_class_name: str + :ivar provisioner: Provisioner of the storage class. + :vartype provisioner: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "KubernetesStorageClassRestoreCriteria". + :vartype object_type: str + """ + + selected_storage_class_name: Optional[str] = rest_field( + name="selectedStorageClassName", visibility=["read", "create", "update", "delete", "query"] + ) + """Selected storage class name.""" + provisioner: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Provisioner of the storage class.""" + object_type: Literal["KubernetesStorageClassRestoreCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"KubernetesStorageClassRestoreCriteria\".""" + + @overload + def __init__( + self, + *, + selected_storage_class_name: Optional[str] = None, + provisioner: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "KubernetesStorageClassRestoreCriteria" # type: ignore + + +class MonitoringSettings(_Model): + """Monitoring Settings. + + :ivar azure_monitor_alert_settings: Settings for Azure Monitor based alerts. + :vartype azure_monitor_alert_settings: + ~azure.mgmt.dataprotection.models.AzureMonitorAlertSettings + """ + + azure_monitor_alert_settings: Optional["_models.AzureMonitorAlertSettings"] = rest_field( + name="azureMonitorAlertSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Settings for Azure Monitor based alerts.""" + + @overload + def __init__( + self, + *, + azure_monitor_alert_settings: Optional["_models.AzureMonitorAlertSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NamespacedNameResource(_Model): + """Class to refer resources which contains namespace and name. + + :ivar name: Name of the resource. + :vartype name: str + :ivar namespace: Namespace in which the resource exists. + :vartype namespace: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the resource.""" + namespace: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Namespace in which the resource exists.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + namespace: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.dataprotection.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.dataprotection.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.dataprotection.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for and operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OperationExtendedInfo(_Model): + """Operation Extended Info. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + OperationJobExtendedInfo + + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. Default value is None. + :vartype object_type: str + """ + + __mapping__: dict[str, _Model] = {} + object_type: str = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) + """This property will be used as the discriminator for deciding the specific types in the + polymorphic chain of types. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + object_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationJobExtendedInfo(OperationExtendedInfo, discriminator="OperationJobExtendedInfo"): + """Operation Job Extended Info. + + :ivar job_id: Name or Arm Id of the job created for this operation. + :vartype job_id: str + :ivar object_type: This property will be used as the discriminator for deciding the specific + types in the polymorphic chain of types. Required. Default value is "OperationJobExtendedInfo". + :vartype object_type: str + """ + + job_id: Optional[str] = rest_field(name="jobId", visibility=["read", "create", "update", "delete", "query"]) + """Name or Arm Id of the job created for this operation.""" + object_type: Literal["OperationJobExtendedInfo"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """This property will be used as the discriminator for deciding the specific types in the + polymorphic chain of types. Required. Default value is \"OperationJobExtendedInfo\".""" + + @overload + def __init__( + self, + *, + job_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "OperationJobExtendedInfo" # type: ignore + + +class OperationResource(_Model): + """Operation Resource. + + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: Required if status == failed or status == canceled. This is the OData v4 error + format, used by the RPC and will go into the v2.2 Azure REST API guidelines. + The full set of optional properties (e.g. inner errors / details) can be found in the "Error + Response" section. + :vartype error: ~azure.mgmt.dataprotection.models.Error + :ivar id: It should match what is used to GET the operation result. + :vartype id: str + :ivar name: It must match the last segment of the "id" field, and will typically be a GUID / + system generated value. + :vartype name: str + :ivar properties: End time of the operation. + :vartype properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar status: + :vartype status: str + """ + + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End time of the operation.""" + error: Optional["_models.Error"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required if status == failed or status == canceled. This is the OData v4 error format, used by + the RPC and will go into the v2.2 Azure REST API guidelines. + The full set of optional properties (e.g. inner errors / details) can be found in the \"Error + Response\" section.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """It should match what is used to GET the operation result.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """It must match the last segment of the \"id\" field, and will typically be a GUID / system + generated value.""" + properties: Optional["_models.OperationExtendedInfo"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """End time of the operation.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Start time of the operation.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + end_time: Optional[datetime.datetime] = None, + error: Optional["_models.Error"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + properties: Optional["_models.OperationExtendedInfo"] = None, + start_time: Optional[datetime.datetime] = None, + status: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PatchBackupVaultInput(_Model): + """Backup Vault Contract for Patch Backup Vault API. + + :ivar monitoring_settings: Monitoring Settings. + :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings + :ivar security_settings: Security Settings. + :vartype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings + :ivar feature_settings: Feature Settings. + :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + """ + + monitoring_settings: Optional["_models.MonitoringSettings"] = rest_field( + name="monitoringSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Monitoring Settings.""" + security_settings: Optional["_models.SecuritySettings"] = rest_field( + name="securitySettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Security Settings.""" + feature_settings: Optional["_models.FeatureSettings"] = rest_field( + name="featureSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Feature Settings.""" + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + + @overload + def __init__( + self, + *, + monitoring_settings: Optional["_models.MonitoringSettings"] = None, + security_settings: Optional["_models.SecuritySettings"] = None, + feature_settings: Optional["_models.FeatureSettings"] = None, + resource_guard_operation_requests: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PatchResourceGuardInput(_Model): + """Patch Request content for Microsoft.DataProtection Resource Guard resources. + + :ivar tags: Resource Guard tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Guard tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PatchResourceRequestInput(_Model): + """Patch Request content for Microsoft.DataProtection resources. + + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.PatchBackupVaultInput + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + identity: Optional["_models.DppIdentityDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Input Managed Identity Details.""" + properties: Optional["_models.PatchBackupVaultInput"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + identity: Optional["_models.DppIdentityDetails"] = None, + properties: Optional["_models.PatchBackupVaultInput"] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PolicyInfo(_Model): + """Policy Info in backupInstance. + + :ivar policy_id: Required. + :vartype policy_id: str + :ivar policy_version: + :vartype policy_version: str + :ivar policy_parameters: Policy parameters for the backup instance. + :vartype policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters + """ + + policy_id: str = rest_field(name="policyId", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + policy_version: Optional[str] = rest_field(name="policyVersion", visibility=["read"]) + policy_parameters: Optional["_models.PolicyParameters"] = rest_field( + name="policyParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Policy parameters for the backup instance.""" + + @overload + def __init__( + self, + *, + policy_id: str, + policy_parameters: Optional["_models.PolicyParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PolicyParameters(_Model): + """Parameters in Policy. + + :ivar data_store_parameters_list: Gets or sets the DataStore Parameters. + :vartype data_store_parameters_list: + list[~azure.mgmt.dataprotection.models.DataStoreParameters] + :ivar backup_datasource_parameters_list: Gets or sets the Backup Data Source Parameters. + :vartype backup_datasource_parameters_list: + list[~azure.mgmt.dataprotection.models.BackupDatasourceParameters] + """ + + data_store_parameters_list: Optional[list["_models.DataStoreParameters"]] = rest_field( + name="dataStoreParametersList", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the DataStore Parameters.""" + backup_datasource_parameters_list: Optional[list["_models.BackupDatasourceParameters"]] = rest_field( + name="backupDatasourceParametersList", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the Backup Data Source Parameters.""" + + @overload + def __init__( + self, + *, + data_store_parameters_list: Optional[list["_models.DataStoreParameters"]] = None, + backup_datasource_parameters_list: Optional[list["_models.BackupDatasourceParameters"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProtectionStatusDetails(_Model): + """Protection status details. + + :ivar error_details: Specifies the protection status error of the resource. + :vartype error_details: ~azure.mgmt.dataprotection.models.UserFacingError + :ivar status: Specifies the protection status of the resource. Known values are: + "ConfiguringProtection", "ConfiguringProtectionFailed", "ProtectionConfigured", + "ProtectionStopped", "SoftDeleted", and "SoftDeleting". + :vartype status: str or ~azure.mgmt.dataprotection.models.Status + """ + + error_details: Optional["_models.UserFacingError"] = rest_field( + name="errorDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the protection status error of the resource.""" + status: Optional[Union[str, "_models.Status"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the protection status of the resource. Known values are: \"ConfiguringProtection\", + \"ConfiguringProtectionFailed\", \"ProtectionConfigured\", \"ProtectionStopped\", + \"SoftDeleted\", and \"SoftDeleting\".""" + + @overload + def __init__( + self, + *, + error_details: Optional["_models.UserFacingError"] = None, + status: Optional[Union[str, "_models.Status"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RangeBasedItemLevelRestoreCriteria(ItemLevelRestoreCriteria, discriminator="RangeBasedItemLevelRestoreCriteria"): + """Item Level target info for restore operation. + + :ivar min_matching_value: minimum value for range prefix match. + :vartype min_matching_value: str + :ivar max_matching_value: maximum value for range prefix match. + :vartype max_matching_value: str + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "RangeBasedItemLevelRestoreCriteria". + :vartype object_type: str + """ + + min_matching_value: Optional[str] = rest_field( + name="minMatchingValue", visibility=["read", "create", "update", "delete", "query"] + ) + """minimum value for range prefix match.""" + max_matching_value: Optional[str] = rest_field( + name="maxMatchingValue", visibility=["read", "create", "update", "delete", "query"] + ) + """maximum value for range prefix match.""" + object_type: Literal["RangeBasedItemLevelRestoreCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"RangeBasedItemLevelRestoreCriteria\".""" + + @overload + def __init__( + self, + *, + min_matching_value: Optional[str] = None, + max_matching_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "RangeBasedItemLevelRestoreCriteria" # type: ignore + + +class RecoveryPointDataStoreDetails(_Model): + """RecoveryPoint datastore details. + + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar id: + :vartype id: str + :ivar meta_data: + :vartype meta_data: str + :ivar state: + :vartype state: str + :ivar type: + :vartype type: str + :ivar visible: + :vartype visible: bool + :ivar rehydration_expiry_time: + :vartype rehydration_expiry_time: ~datetime.datetime + :ivar rehydration_status: Known values are: "CREATE_IN_PROGRESS", "COMPLETED", + "DELETE_IN_PROGRESS", "DELETED", and "FAILED". + :vartype rehydration_status: str or ~azure.mgmt.dataprotection.models.RehydrationStatus + """ + + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + expiry_time: Optional[datetime.datetime] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + meta_data: Optional[str] = rest_field(name="metaData", visibility=["read", "create", "update", "delete", "query"]) + state: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + visible: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + rehydration_expiry_time: Optional[datetime.datetime] = rest_field( + name="rehydrationExpiryTime", visibility=["read"], format="rfc3339" + ) + rehydration_status: Optional[Union[str, "_models.RehydrationStatus"]] = rest_field( + name="rehydrationStatus", visibility=["read"] + ) + """Known values are: \"CREATE_IN_PROGRESS\", \"COMPLETED\", \"DELETE_IN_PROGRESS\", \"DELETED\", + and \"FAILED\".""" + + @overload + def __init__( + self, + *, + creation_time: Optional[datetime.datetime] = None, + expiry_time: Optional[datetime.datetime] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + meta_data: Optional[str] = None, + state: Optional[str] = None, + type: Optional[str] = None, + visible: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceGuard(_Model): + """ResourceGuard. + + :ivar provisioning_state: Provisioning state of the BackupVault resource. Known values are: + "Failed", "Provisioning", "Succeeded", "Unknown", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState + :ivar allow_auto_approvals: This flag indicates whether auto approval is allowed or not. + :vartype allow_auto_approvals: bool + :ivar resource_guard_operations: {readonly} List of operation details those are protected by + the ResourceGuard resource. + :vartype resource_guard_operations: + list[~azure.mgmt.dataprotection.models.ResourceGuardOperation] + :ivar vault_critical_operation_exclusion_list: List of critical operations which are not + protected by this resourceGuard. + :vartype vault_critical_operation_exclusion_list: list[str] + :ivar description: Description about the pre-req steps to perform all the critical operations. + :vartype description: str + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the BackupVault resource. Known values are: \"Failed\", \"Provisioning\", + \"Succeeded\", \"Unknown\", and \"Updating\".""" + allow_auto_approvals: Optional[bool] = rest_field(name="allowAutoApprovals", visibility=["read"]) + """This flag indicates whether auto approval is allowed or not.""" + resource_guard_operations: Optional[list["_models.ResourceGuardOperation"]] = rest_field( + name="resourceGuardOperations", visibility=["read"] + ) + """{readonly} List of operation details those are protected by the ResourceGuard resource.""" + vault_critical_operation_exclusion_list: Optional[list[str]] = rest_field( + name="vaultCriticalOperationExclusionList", visibility=["read", "create", "update", "delete", "query"] + ) + """List of critical operations which are not protected by this resourceGuard.""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description about the pre-req steps to perform all the critical operations.""" + + @overload + def __init__( + self, + *, + vault_critical_operation_exclusion_list: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceGuardOperation(_Model): + """This class contains all the details about a critical operation. + + :ivar vault_critical_operation: Name of the critical operation. + :vartype vault_critical_operation: str + :ivar request_resource_type: Type of resource request. + :vartype request_resource_type: str + """ + + vault_critical_operation: Optional[str] = rest_field(name="vaultCriticalOperation", visibility=["read"]) + """Name of the critical operation.""" + request_resource_type: Optional[str] = rest_field(name="requestResourceType", visibility=["read"]) + """Type of resource request.""" + + +class ResourceGuardOperationDetail(_Model): + """VaultCritical Operation protected by a resource guard. + + :ivar vault_critical_operation: + :vartype vault_critical_operation: str + :ivar default_resource_request: + :vartype default_resource_request: str + """ + + vault_critical_operation: Optional[str] = rest_field( + name="vaultCriticalOperation", visibility=["read", "create", "update", "delete", "query"] + ) + default_resource_request: Optional[str] = rest_field( + name="defaultResourceRequest", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + vault_critical_operation: Optional[str] = None, + default_resource_request: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceGuardProxyBase(_Model): + """ResourceGuardProxyBase object, used in ResourceGuardProxyBaseResource. + + :ivar resource_guard_resource_id: + :vartype resource_guard_resource_id: str + :ivar resource_guard_operation_details: + :vartype resource_guard_operation_details: + list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] + :ivar last_updated_time: + :vartype last_updated_time: str + :ivar description: + :vartype description: str + """ + + resource_guard_resource_id: Optional[str] = rest_field( + name="resourceGuardResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + resource_guard_operation_details: Optional[list["_models.ResourceGuardOperationDetail"]] = rest_field( + name="resourceGuardOperationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + last_updated_time: Optional[str] = rest_field( + name="lastUpdatedTime", visibility=["read", "create", "update", "delete", "query"] + ) + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + @overload + def __init__( + self, + *, + resource_guard_resource_id: Optional[str] = None, + resource_guard_operation_details: Optional[list["_models.ResourceGuardOperationDetail"]] = None, + last_updated_time: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceGuardProxyBaseResource(ProxyResource): + """ResourceGuardProxyBaseResource object, used for response and request bodies for + ResourceGuardProxy APIs. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar properties: ResourceGuardProxyBaseResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase + """ + + properties: Optional["_models.ResourceGuardProxyBase"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardProxyBaseResource properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ResourceGuardProxyBase"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceGuardResource(TrackedResource): + """Concrete tracked resource types can be created by aliasing this type using a specific property + type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: ResourceGuardResource properties. + :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuard + :ivar e_tag: Optional ETag. + :vartype e_tag: str + """ + + properties: Optional["_models.ResourceGuard"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardResource properties.""" + e_tag: Optional[str] = rest_field(name="eTag", visibility=["read", "create", "update", "delete", "query"]) + """Optional ETag.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ResourceGuard"] = None, + e_tag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceMoveDetails(_Model): + """ResourceMoveDetails will be returned in response to GetResource call from ARM. + + :ivar operation_id: CorrelationId of latest ResourceMove operation attempted. + :vartype operation_id: str + :ivar start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 + format. + :vartype start_time_utc: str + :ivar completion_time_utc: Completion time in UTC of latest ResourceMove operation attempted. + ISO 8601 format. + :vartype completion_time_utc: str + :ivar source_resource_path: ARM resource path of source resource. + :vartype source_resource_path: str + :ivar target_resource_path: ARM resource path of target resource used in latest ResourceMove + operation. + :vartype target_resource_path: str + """ + + operation_id: Optional[str] = rest_field( + name="operationId", visibility=["read", "create", "update", "delete", "query"] + ) + """CorrelationId of latest ResourceMove operation attempted.""" + start_time_utc: Optional[str] = rest_field( + name="startTimeUtc", visibility=["read", "create", "update", "delete", "query"] + ) + """Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format.""" + completion_time_utc: Optional[str] = rest_field( + name="completionTimeUtc", visibility=["read", "create", "update", "delete", "query"] + ) + """Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format.""" + source_resource_path: Optional[str] = rest_field( + name="sourceResourcePath", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM resource path of source resource.""" + target_resource_path: Optional[str] = rest_field( + name="targetResourcePath", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM resource path of target resource used in latest ResourceMove operation.""" + + @overload + def __init__( + self, + *, + operation_id: Optional[str] = None, + start_time_utc: Optional[str] = None, + completion_time_utc: Optional[str] = None, + source_resource_path: Optional[str] = None, + target_resource_path: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorableTimeRange(_Model): + """RestorableTimeRange. + + :ivar start_time: Start time for the available restore range. Required. + :vartype start_time: str + :ivar end_time: End time for the available restore range. Required. + :vartype end_time: str + :ivar object_type: + :vartype object_type: str + """ + + start_time: str = rest_field(name="startTime", visibility=["read", "create", "update", "delete", "query"]) + """Start time for the available restore range. Required.""" + end_time: str = rest_field(name="endTime", visibility=["read", "create", "update", "delete", "query"]) + """End time for the available restore range. Required.""" + object_type: Optional[str] = rest_field( + name="objectType", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + start_time: str, + end_time: str, + object_type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestoreFilesTargetInfo(RestoreTargetInfoBase, discriminator="RestoreFilesTargetInfo"): + """Class encapsulating restore as files target parameters. + + :ivar recovery_option: Recovery Option. Required. "FailIfExists" + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + :ivar target_details: Destination of RestoreAsFiles operation, when destination is not a + datasource. Required. + :vartype target_details: ~azure.mgmt.dataprotection.models.TargetDetails + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + Required. Default value is "RestoreFilesTargetInfo". + :vartype object_type: str + """ + + target_details: "_models.TargetDetails" = rest_field( + name="targetDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Destination of RestoreAsFiles operation, when destination is not a datasource. Required.""" + object_type: Literal["RestoreFilesTargetInfo"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of Datasource object, used to initialize the right inherited type. Required. Default value + is \"RestoreFilesTargetInfo\".""" + + @overload + def __init__( + self, + *, + recovery_option: Union[str, "_models.RecoveryOption"], + target_details: "_models.TargetDetails", + restore_location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "RestoreFilesTargetInfo" # type: ignore + + +class RestoreJobRecoveryPointDetails(_Model): + """RestoreJobRecoveryPointDetails. + + :ivar recovery_point_id: + :vartype recovery_point_id: str + :ivar recovery_point_time: + :vartype recovery_point_time: ~datetime.datetime + """ + + recovery_point_id: Optional[str] = rest_field( + name="recoveryPointID", visibility=["read", "create", "update", "delete", "query"] + ) + recovery_point_time: Optional[datetime.datetime] = rest_field( + name="recoveryPointTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + + @overload + def __init__( + self, + *, + recovery_point_id: Optional[str] = None, + recovery_point_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestoreTargetInfo(RestoreTargetInfoBase, discriminator="RestoreTargetInfo"): + """Class encapsulating restore target parameters. + + :ivar recovery_option: Recovery Option. Required. "FailIfExists" + :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption + :ivar restore_location: Target Restore region. + :vartype restore_location: str + :ivar datasource_info: Information of target DS. Required. + :vartype datasource_info: ~azure.mgmt.dataprotection.models.Datasource + :ivar datasource_set_info: Information of target DS Set. + :vartype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet + :ivar datasource_auth_credentials: Credentials to use to authenticate with data source + provider. + :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials + :ivar object_type: Type of Datasource object, used to initialize the right inherited type. + Required. Default value is "RestoreTargetInfo". + :vartype object_type: str + """ + + datasource_info: "_models.Datasource" = rest_field( + name="datasourceInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Information of target DS. Required.""" + datasource_set_info: Optional["_models.DatasourceSet"] = rest_field( + name="datasourceSetInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Information of target DS Set.""" + datasource_auth_credentials: Optional["_models.AuthCredentials"] = rest_field( + name="datasourceAuthCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """Credentials to use to authenticate with data source provider.""" + object_type: Literal["RestoreTargetInfo"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of Datasource object, used to initialize the right inherited type. Required. Default value + is \"RestoreTargetInfo\".""" + + @overload + def __init__( + self, + *, + recovery_option: Union[str, "_models.RecoveryOption"], + datasource_info: "_models.Datasource", + restore_location: Optional[str] = None, + datasource_set_info: Optional["_models.DatasourceSet"] = None, + datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "RestoreTargetInfo" # type: ignore + + +class RetentionTag(_Model): + """Retention tag. + + :ivar e_tag: Retention Tag version. + :vartype e_tag: str + :ivar id: Retention Tag version. + :vartype id: str + :ivar tag_name: Retention Tag Name to relate it to retention rule. Required. + :vartype tag_name: str + """ + + e_tag: Optional[str] = rest_field(name="eTag", visibility=["read"]) + """Retention Tag version.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Retention Tag version.""" + tag_name: str = rest_field(name="tagName", visibility=["read", "create", "update", "delete", "query"]) + """Retention Tag Name to relate it to retention rule. Required.""" + + @overload + def __init__( + self, + *, + tag_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduleBasedBackupCriteria(BackupCriteria, discriminator="ScheduleBasedBackupCriteria"): + """Schedule based backup criteria. + + :ivar absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / + "FirstOfWeek" / "FirstOfMonth" + and should be part of AbsoluteMarker enum. + :vartype absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] + :ivar days_of_month: This is day of the month from 1 to 28 other wise last of month. + :vartype days_of_month: list[~azure.mgmt.dataprotection.models.Day] + :ivar days_of_the_week: It should be Sunday/Monday/T..../Saturday. + :vartype days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] + :ivar months_of_year: It should be January/February/....../December. + :vartype months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] + :ivar schedule_times: List of schedule times for backup. + :vartype schedule_times: list[~datetime.datetime] + :ivar weeks_of_the_month: It should be First/Second/Third/Fourth/Last. + :vartype weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "ScheduleBasedBackupCriteria". + :vartype object_type: str + """ + + absolute_criteria: Optional[list[Union[str, "_models.AbsoluteMarker"]]] = rest_field( + name="absoluteCriteria", visibility=["read", "create", "update", "delete", "query"] + ) + """it contains absolute values like \"AllBackup\" / \"FirstOfDay\" / \"FirstOfWeek\" / + \"FirstOfMonth\" + and should be part of AbsoluteMarker enum.""" + days_of_month: Optional[list["_models.Day"]] = rest_field( + name="daysOfMonth", visibility=["read", "create", "update", "delete", "query"] + ) + """This is day of the month from 1 to 28 other wise last of month.""" + days_of_the_week: Optional[list[Union[str, "_models.DayOfWeek"]]] = rest_field( + name="daysOfTheWeek", visibility=["read", "create", "update", "delete", "query"] + ) + """It should be Sunday/Monday/T..../Saturday.""" + months_of_year: Optional[list[Union[str, "_models.Month"]]] = rest_field( + name="monthsOfYear", visibility=["read", "create", "update", "delete", "query"] + ) + """It should be January/February/....../December.""" + schedule_times: Optional[list[datetime.datetime]] = rest_field( + name="scheduleTimes", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """List of schedule times for backup.""" + weeks_of_the_month: Optional[list[Union[str, "_models.WeekNumber"]]] = rest_field( + name="weeksOfTheMonth", visibility=["read", "create", "update", "delete", "query"] + ) + """It should be First/Second/Third/Fourth/Last.""" + object_type: Literal["ScheduleBasedBackupCriteria"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"ScheduleBasedBackupCriteria\".""" + + @overload + def __init__( + self, + *, + absolute_criteria: Optional[list[Union[str, "_models.AbsoluteMarker"]]] = None, + days_of_month: Optional[list["_models.Day"]] = None, + days_of_the_week: Optional[list[Union[str, "_models.DayOfWeek"]]] = None, + months_of_year: Optional[list[Union[str, "_models.Month"]]] = None, + schedule_times: Optional[list[datetime.datetime]] = None, + weeks_of_the_month: Optional[list[Union[str, "_models.WeekNumber"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "ScheduleBasedBackupCriteria" # type: ignore + + +class ScheduleBasedTriggerContext(TriggerContext, discriminator="ScheduleBasedTriggerContext"): + """Schedule based trigger context. + + :ivar schedule: Schedule for this backup. Required. + :vartype schedule: ~azure.mgmt.dataprotection.models.BackupSchedule + :ivar tagging_criteria: List of tags that can be applicable for given schedule. Required. + :vartype tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "ScheduleBasedTriggerContext". + :vartype object_type: str + """ + + schedule: "_models.BackupSchedule" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Schedule for this backup. Required.""" + tagging_criteria: list["_models.TaggingCriteria"] = rest_field( + name="taggingCriteria", visibility=["read", "create", "update", "delete", "query"] + ) + """List of tags that can be applicable for given schedule. Required.""" + object_type: Literal["ScheduleBasedTriggerContext"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"ScheduleBasedTriggerContext\".""" + + @overload + def __init__( + self, + *, + schedule: "_models.BackupSchedule", + tagging_criteria: list["_models.TaggingCriteria"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "ScheduleBasedTriggerContext" # type: ignore + + +class SecretStoreBasedAuthCredentials(AuthCredentials, discriminator="SecretStoreBasedAuthCredentials"): + """Secret store based authentication credentials. + + :ivar secret_store_resource: Secret store resource. + :vartype secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource + :ivar object_type: Type of the specific object - used for deserializing. Required. Default + value is "SecretStoreBasedAuthCredentials". + :vartype object_type: str + """ + + secret_store_resource: Optional["_models.SecretStoreResource"] = rest_field( + name="secretStoreResource", visibility=["read", "create", "update", "delete", "query"] + ) + """Secret store resource.""" + object_type: Literal["SecretStoreBasedAuthCredentials"] = rest_discriminator(name="objectType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Type of the specific object - used for deserializing. Required. Default value is + \"SecretStoreBasedAuthCredentials\".""" + + @overload + def __init__( + self, + *, + secret_store_resource: Optional["_models.SecretStoreResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.object_type = "SecretStoreBasedAuthCredentials" # type: ignore + + +class SecretStoreResource(_Model): + """Class representing a secret store resource. + + :ivar uri: Uri to get to the resource. + :vartype uri: str + :ivar secret_store_type: Gets or sets the type of secret store. Required. Known values are: + "Invalid" and "AzureKeyVault". + :vartype secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType + :ivar value: Gets or sets value stored in secret store resource. + :vartype value: str + """ + + uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Uri to get to the resource.""" + secret_store_type: Union[str, "_models.SecretStoreType"] = rest_field( + name="secretStoreType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of secret store. Required. Known values are: \"Invalid\" and + \"AzureKeyVault\".""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets value stored in secret store resource.""" + + @overload + def __init__( + self, + *, + secret_store_type: Union[str, "_models.SecretStoreType"], + uri: Optional[str] = None, + value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecuritySettings(_Model): + """Class containing security settings of vault. + + :ivar soft_delete_settings: Soft delete related settings. + :vartype soft_delete_settings: ~azure.mgmt.dataprotection.models.SoftDeleteSettings + :ivar immutability_settings: Immutability Settings at vault level. + :vartype immutability_settings: ~azure.mgmt.dataprotection.models.ImmutabilitySettings + :ivar encryption_settings: Customer Managed Key details of the resource. + :vartype encryption_settings: ~azure.mgmt.dataprotection.models.EncryptionSettings + """ + + soft_delete_settings: Optional["_models.SoftDeleteSettings"] = rest_field( + name="softDeleteSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Soft delete related settings.""" + immutability_settings: Optional["_models.ImmutabilitySettings"] = rest_field( + name="immutabilitySettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Immutability Settings at vault level.""" + encryption_settings: Optional["_models.EncryptionSettings"] = rest_field( + name="encryptionSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Customer Managed Key details of the resource.""" + + @overload + def __init__( + self, + *, + soft_delete_settings: Optional["_models.SoftDeleteSettings"] = None, + immutability_settings: Optional["_models.ImmutabilitySettings"] = None, + encryption_settings: Optional["_models.EncryptionSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SoftDeleteSettings(_Model): + """Soft delete related settings. + + :ivar state: State of soft delete. Known values are: "Off", "On", and "AlwaysOn". + :vartype state: str or ~azure.mgmt.dataprotection.models.SoftDeleteState + :ivar retention_duration_in_days: Soft delete retention duration. + :vartype retention_duration_in_days: float + """ + + state: Optional[Union[str, "_models.SoftDeleteState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """State of soft delete. Known values are: \"Off\", \"On\", and \"AlwaysOn\".""" + retention_duration_in_days: Optional[float] = rest_field( + name="retentionDurationInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Soft delete retention duration.""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.SoftDeleteState"]] = None, + retention_duration_in_days: Optional[float] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SourceLifeCycle(_Model): + """Source LifeCycle. + + :ivar delete_after: Delete Option. Required. + :vartype delete_after: ~azure.mgmt.dataprotection.models.DeleteOption + :ivar source_data_store: DataStoreInfo base. Required. + :vartype source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + :ivar target_data_store_copy_settings: + :vartype target_data_store_copy_settings: + list[~azure.mgmt.dataprotection.models.TargetCopySetting] + """ + + delete_after: "_models.DeleteOption" = rest_field( + name="deleteAfter", visibility=["read", "create", "update", "delete", "query"] + ) + """Delete Option. Required.""" + source_data_store: "_models.DataStoreInfoBase" = rest_field( + name="sourceDataStore", visibility=["read", "create", "update", "delete", "query"] + ) + """DataStoreInfo base. Required.""" + target_data_store_copy_settings: Optional[list["_models.TargetCopySetting"]] = rest_field( + name="targetDataStoreCopySettings", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + delete_after: "_models.DeleteOption", + source_data_store: "_models.DataStoreInfoBase", + target_data_store_copy_settings: Optional[list["_models.TargetCopySetting"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StopProtectionRequest(_Model): + """Request body of Stop protection when MUA is Enabled. + + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + """ + + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + + @overload + def __init__( + self, + *, + resource_guard_operation_requests: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class StorageSetting(_Model): + """Storage setting. + + :ivar datastore_type: Gets or sets the type of the datastore. Known values are: "ArchiveStore", + "OperationalStore", and "VaultStore". + :vartype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes + :ivar type: Gets or sets the type. Known values are: "GeoRedundant", "LocallyRedundant", and + "ZoneRedundant". + :vartype type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes + """ + + datastore_type: Optional[Union[str, "_models.StorageSettingStoreTypes"]] = rest_field( + name="datastoreType", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type of the datastore. Known values are: \"ArchiveStore\", + \"OperationalStore\", and \"VaultStore\".""" + type: Optional[Union[str, "_models.StorageSettingTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the type. Known values are: \"GeoRedundant\", \"LocallyRedundant\", and + \"ZoneRedundant\".""" + + @overload + def __init__( + self, + *, + datastore_type: Optional[Union[str, "_models.StorageSettingStoreTypes"]] = None, + type: Optional[Union[str, "_models.StorageSettingTypes"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SupportedFeature(_Model): + """Elements class for feature request. + + :ivar feature_name: support feature type. + :vartype feature_name: str + :ivar support_status: feature support status. Known values are: "Invalid", "NotSupported", + "AlphaPreview", "PrivatePreview", "PublicPreview", and "GenerallyAvailable". + :vartype support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus + :ivar exposure_controlled_features: support feature type. + :vartype exposure_controlled_features: list[str] + """ + + feature_name: Optional[str] = rest_field( + name="featureName", visibility=["read", "create", "update", "delete", "query"] + ) + """support feature type.""" + support_status: Optional[Union[str, "_models.FeatureSupportStatus"]] = rest_field( + name="supportStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """feature support status. Known values are: \"Invalid\", \"NotSupported\", \"AlphaPreview\", + \"PrivatePreview\", \"PublicPreview\", and \"GenerallyAvailable\".""" + exposure_controlled_features: Optional[list[str]] = rest_field( + name="exposureControlledFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """support feature type.""" + + @overload + def __init__( + self, + *, + feature_name: Optional[str] = None, + support_status: Optional[Union[str, "_models.FeatureSupportStatus"]] = None, + exposure_controlled_features: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SuspendBackupRequest(_Model): + """Request body of Suspend backup when MUA is Enabled. + + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + """ + + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + + @overload + def __init__( + self, + *, + resource_guard_operation_requests: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SyncBackupInstanceRequest(_Model): + """Sync BackupInstance Request. + + :ivar sync_type: Field indicating sync type e.g. to sync only in case of failure or in all + cases. Known values are: "Default" and "ForceResync". + :vartype sync_type: str or ~azure.mgmt.dataprotection.models.SyncType + """ + + sync_type: Optional[Union[str, "_models.SyncType"]] = rest_field( + name="syncType", visibility=["read", "create", "update", "delete", "query"] + ) + """Field indicating sync type e.g. to sync only in case of failure or in all cases. Known values + are: \"Default\" and \"ForceResync\".""" + + @overload + def __init__( + self, + *, + sync_type: Optional[Union[str, "_models.SyncType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TaggingCriteria(_Model): + """Tagging criteria. + + :ivar criteria: Criteria which decides whether the tag can be applied to a triggered backup. + :vartype criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] + :ivar is_default: Specifies if tag is default. Required. + :vartype is_default: bool + :ivar tagging_priority: Retention Tag priority. Required. + :vartype tagging_priority: int + :ivar tag_info: Retention tag information. Required. + :vartype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag + """ + + criteria: Optional[list["_models.BackupCriteria"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Criteria which decides whether the tag can be applied to a triggered backup.""" + is_default: bool = rest_field(name="isDefault", visibility=["read", "create", "update", "delete", "query"]) + """Specifies if tag is default. Required.""" + tagging_priority: int = rest_field( + name="taggingPriority", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention Tag priority. Required.""" + tag_info: "_models.RetentionTag" = rest_field( + name="tagInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention tag information. Required.""" + + @overload + def __init__( + self, + *, + is_default: bool, + tagging_priority: int, + tag_info: "_models.RetentionTag", + criteria: Optional[list["_models.BackupCriteria"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TargetCopySetting(_Model): + """Target copy settings. + + :ivar copy_after: It can be CustomCopyOption or ImmediateCopyOption. Required. + :vartype copy_after: ~azure.mgmt.dataprotection.models.CopyOption + :ivar data_store: Info of target datastore. Required. + :vartype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase + """ + + copy_after: "_models.CopyOption" = rest_field( + name="copyAfter", visibility=["read", "create", "update", "delete", "query"] + ) + """It can be CustomCopyOption or ImmediateCopyOption. Required.""" + data_store: "_models.DataStoreInfoBase" = rest_field( + name="dataStore", visibility=["read", "create", "update", "delete", "query"] + ) + """Info of target datastore. Required.""" + + @overload + def __init__( + self, + *, + copy_after: "_models.CopyOption", + data_store: "_models.DataStoreInfoBase", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TargetDetails(_Model): + """Class encapsulating target details, used where the destination is not a datasource. + + :ivar file_prefix: Restore operation may create multiple files inside location pointed by Url + Below will be the common prefix for all of them. Required. + :vartype file_prefix: str + :ivar restore_target_location_type: Denotes the target location where the data will be + restored, + string value for the enum + {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + Required. Known values are: "Invalid", "AzureBlobs", and "AzureFiles". + :vartype restore_target_location_type: str or + ~azure.mgmt.dataprotection.models.RestoreTargetLocationType + :ivar url: Url denoting the restore destination. It can point to container / file share etc. + Required. + :vartype url: str + :ivar target_resource_arm_id: Full ARM Id denoting the restore destination. It is the ARM Id + pointing to container / file share + This is optional if the target subscription can be identified with the URL field. If not + then this is needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled + states. + :vartype target_resource_arm_id: str + """ + + file_prefix: str = rest_field(name="filePrefix", visibility=["read", "create", "update", "delete", "query"]) + """Restore operation may create multiple files inside location pointed by Url + Below will be the common prefix for all of them. Required.""" + restore_target_location_type: Union[str, "_models.RestoreTargetLocationType"] = rest_field( + name="restoreTargetLocationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Denotes the target location where the data will be restored, + string value for the enum + {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + Required. Known values are: \"Invalid\", \"AzureBlobs\", and \"AzureFiles\".""" + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Url denoting the restore destination. It can point to container / file share etc. Required.""" + target_resource_arm_id: Optional[str] = rest_field( + name="targetResourceArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """Full ARM Id denoting the restore destination. It is the ARM Id pointing to container / file + share + This is optional if the target subscription can be identified with the URL field. If not + then this is needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled + states.""" + + @overload + def __init__( + self, + *, + file_prefix: str, + restore_target_location_type: Union[str, "_models.RestoreTargetLocationType"], + url: str, + target_resource_arm_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TriggerBackupRequest(_Model): + """Trigger backup request. + + :ivar backup_rule_options: Name for the Rule of the Policy which needs to be applied for this + backup. Required. + :vartype backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions + """ + + backup_rule_options: "_models.AdHocBackupRuleOptions" = rest_field( + name="backupRuleOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Name for the Rule of the Policy which needs to be applied for this backup. Required.""" + + @overload + def __init__( + self, + *, + backup_rule_options: "_models.AdHocBackupRuleOptions", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UnlockDeleteRequest(_Model): + """Request body of unlock delete API. + + :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will + be performed. + :vartype resource_guard_operation_requests: list[str] + :ivar resource_to_be_deleted: + :vartype resource_to_be_deleted: str + """ + + resource_guard_operation_requests: Optional[list[str]] = rest_field( + name="resourceGuardOperationRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """ResourceGuardOperationRequests on which LAC check will be performed.""" + resource_to_be_deleted: Optional[str] = rest_field( + name="resourceToBeDeleted", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + resource_guard_operation_requests: Optional[list[str]] = None, + resource_to_be_deleted: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UnlockDeleteResponse(_Model): + """Response of Unlock Delete API. + + :ivar unlock_delete_expiry_time: This is the time when unlock delete privileges will get + expired. + :vartype unlock_delete_expiry_time: str + """ + + unlock_delete_expiry_time: Optional[str] = rest_field( + name="unlockDeleteExpiryTime", visibility=["read", "create", "update", "delete", "query"] + ) + """This is the time when unlock delete privileges will get expired.""" + + @overload + def __init__( + self, + *, + unlock_delete_expiry_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + + +class UserFacingError(_Model): + """Error object used by layers that have access to localized content, and propagate that to user. + + :ivar code: Unique code for this error. + :vartype code: str + :ivar details: Additional related Errors. + :vartype details: list[~azure.mgmt.dataprotection.models.UserFacingError] + :ivar inner_error: Inner Error. + :vartype inner_error: ~azure.mgmt.dataprotection.models.InnerError + :ivar is_retryable: Whether the operation will be retryable or not. + :vartype is_retryable: bool + :ivar is_user_error: Whether the operation is due to a user error or service error. + :vartype is_user_error: bool + :ivar properties: Any key value pairs that can be injected inside error object. + :vartype properties: dict[str, str] + :ivar message: + :vartype message: str + :ivar recommended_action: RecommendedAction � localized. + :vartype recommended_action: list[str] + :ivar target: Target of the error. + :vartype target: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Unique code for this error.""" + details: Optional[list["_models.UserFacingError"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Additional related Errors.""" + inner_error: Optional["_models.InnerError"] = rest_field( + name="innerError", visibility=["read", "create", "update", "delete", "query"] + ) + """Inner Error.""" + is_retryable: Optional[bool] = rest_field( + name="isRetryable", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the operation will be retryable or not.""" + is_user_error: Optional[bool] = rest_field( + name="isUserError", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the operation is due to a user error or service error.""" + properties: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Any key value pairs that can be injected inside error object.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + recommended_action: Optional[list[str]] = rest_field( + name="recommendedAction", visibility=["read", "create", "update", "delete", "query"] + ) + """RecommendedAction � localized.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target of the error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + details: Optional[list["_models.UserFacingError"]] = None, + inner_error: Optional["_models.InnerError"] = None, + is_retryable: Optional[bool] = None, + is_user_error: Optional[bool] = None, + properties: Optional[dict[str, str]] = None, + message: Optional[str] = None, + recommended_action: Optional[list[str]] = None, + target: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserFacingWarningDetail(_Model): + """Warning object used by layers that have access to localized content, and propagate that to + user. + + :ivar resource_name: Name of resource for which warning is raised. + :vartype resource_name: str + :ivar warning: Error details for the warning. Required. + :vartype warning: ~azure.mgmt.dataprotection.models.UserFacingError + """ + + resource_name: Optional[str] = rest_field( + name="resourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of resource for which warning is raised.""" + warning: "_models.UserFacingError" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error details for the warning. Required.""" + + @overload + def __init__( + self, + *, + warning: "_models.UserFacingError", + resource_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ValidateCrossRegionRestoreRequestObject(_Model): + """Cross Region Restore Request Object. + + :ivar restore_request_object: Gets or sets the restore request object. Required. + :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :ivar cross_region_restore_details: Cross region restore details. Required. + :vartype cross_region_restore_details: + ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails + """ + + restore_request_object: "_models.AzureBackupRestoreRequest" = rest_field( + name="restoreRequestObject", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the restore request object. Required.""" + cross_region_restore_details: "_models.CrossRegionRestoreDetails" = rest_field( + name="crossRegionRestoreDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Cross region restore details. Required.""" + + @overload + def __init__( + self, + *, + restore_request_object: "_models.AzureBackupRestoreRequest", + cross_region_restore_details: "_models.CrossRegionRestoreDetails", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ValidateForBackupRequest(_Model): + """Validate for backup request. + + :ivar backup_instance: Backup Instance. Required. + :vartype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance + """ + + backup_instance: "_models.BackupInstance" = rest_field( + name="backupInstance", visibility=["read", "create", "update", "delete", "query"] + ) + """Backup Instance. Required.""" + + @overload + def __init__( + self, + *, + backup_instance: "_models.BackupInstance", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ValidateForModifyBackupRequest(_Model): + """Validate for modify backup request. + + :ivar backup_instance: Backup Instance. Required. + :vartype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance + """ + + backup_instance: "_models.BackupInstance" = rest_field( + name="backupInstance", visibility=["read", "create", "update", "delete", "query"] + ) + """Backup Instance. Required.""" + + @overload + def __init__( + self, + *, + backup_instance: "_models.BackupInstance", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ValidateRestoreRequestObject(_Model): + """Validate restore request object. + + :ivar restore_request_object: Gets or sets the restore request object. Required. + :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + """ + + restore_request_object: "_models.AzureBackupRestoreRequest" = rest_field( + name="restoreRequestObject", visibility=["read", "create", "update", "delete", "query"] + ) + """Gets or sets the restore request object. Required.""" + + @overload + def __init__( + self, + *, + restore_request_object: "_models.AzureBackupRestoreRequest", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py deleted file mode 100644 index d8d4e2f07212..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py +++ /dev/null @@ -1,7595 +0,0 @@ -# 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. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class DeleteOption(_serialization.Model): - """Delete Option. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AbsoluteDeleteOption - - All required parameters must be populated in order to send to server. - - :ivar duration: Duration of deletion after given timespan. Required. - :vartype duration: str - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "duration": {"required": True}, - "object_type": {"required": True}, - } - - _attribute_map = { - "duration": {"key": "duration", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"AbsoluteDeleteOption": "AbsoluteDeleteOption"}} - - def __init__(self, *, duration: str, **kwargs: Any) -> None: - """ - :keyword duration: Duration of deletion after given timespan. Required. - :paramtype duration: str - """ - super().__init__(**kwargs) - self.duration = duration - self.object_type: Optional[str] = None - - -class AbsoluteDeleteOption(DeleteOption): - """Delete option with duration. - - All required parameters must be populated in order to send to server. - - :ivar duration: Duration of deletion after given timespan. Required. - :vartype duration: str - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "duration": {"required": True}, - "object_type": {"required": True}, - } - - _attribute_map = { - "duration": {"key": "duration", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__(self, *, duration: str, **kwargs: Any) -> None: - """ - :keyword duration: Duration of deletion after given timespan. Required. - :paramtype duration: str - """ - super().__init__(duration=duration, **kwargs) - self.object_type: str = "AbsoluteDeleteOption" - - -class AdHocBackupRuleOptions(_serialization.Model): - """Adhoc backup rules. - - All required parameters must be populated in order to send to server. - - :ivar rule_name: Required. - :vartype rule_name: str - :ivar trigger_option: Adhoc backup trigger option. Required. - :vartype trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption - """ - - _validation = { - "rule_name": {"required": True}, - "trigger_option": {"required": True}, - } - - _attribute_map = { - "rule_name": {"key": "ruleName", "type": "str"}, - "trigger_option": {"key": "triggerOption", "type": "AdhocBackupTriggerOption"}, - } - - def __init__(self, *, rule_name: str, trigger_option: "_models.AdhocBackupTriggerOption", **kwargs: Any) -> None: - """ - :keyword rule_name: Required. - :paramtype rule_name: str - :keyword trigger_option: Adhoc backup trigger option. Required. - :paramtype trigger_option: ~azure.mgmt.dataprotection.models.AdhocBackupTriggerOption - """ - super().__init__(**kwargs) - self.rule_name = rule_name - self.trigger_option = trigger_option - - -class AdhocBackupTriggerOption(_serialization.Model): - """Adhoc backup trigger option. - - :ivar retention_tag_override: - :vartype retention_tag_override: str - """ - - _attribute_map = { - "retention_tag_override": {"key": "retentionTagOverride", "type": "str"}, - } - - def __init__(self, *, retention_tag_override: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword retention_tag_override: - :paramtype retention_tag_override: str - """ - super().__init__(**kwargs) - self.retention_tag_override = retention_tag_override - - -class AdhocBasedTaggingCriteria(_serialization.Model): - """Adhoc backup tagging criteria. - - :ivar tag_info: Retention tag information. - :vartype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag - """ - - _attribute_map = { - "tag_info": {"key": "tagInfo", "type": "RetentionTag"}, - } - - def __init__(self, *, tag_info: Optional["_models.RetentionTag"] = None, **kwargs: Any) -> None: - """ - :keyword tag_info: Retention tag information. - :paramtype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag - """ - super().__init__(**kwargs) - self.tag_info = tag_info - - -class TriggerContext(_serialization.Model): - """Trigger context. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AdhocBasedTriggerContext, ScheduleBasedTriggerContext - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = { - "object_type": { - "AdhocBasedTriggerContext": "AdhocBasedTriggerContext", - "ScheduleBasedTriggerContext": "ScheduleBasedTriggerContext", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class AdhocBasedTriggerContext(TriggerContext): - """Adhoc trigger context. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar tagging_criteria: Tagging Criteria containing retention tag for adhoc backup. Required. - :vartype tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria - """ - - _validation = { - "object_type": {"required": True}, - "tagging_criteria": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "tagging_criteria": {"key": "taggingCriteria", "type": "AdhocBasedTaggingCriteria"}, - } - - def __init__(self, *, tagging_criteria: "_models.AdhocBasedTaggingCriteria", **kwargs: Any) -> None: - """ - :keyword tagging_criteria: Tagging Criteria containing retention tag for adhoc backup. - Required. - :paramtype tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria - """ - super().__init__(**kwargs) - self.object_type: str = "AdhocBasedTriggerContext" - self.tagging_criteria = tagging_criteria - - -class AuthCredentials(_serialization.Model): - """Base class for different types of authentication credentials. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - SecretStoreBasedAuthCredentials - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"SecretStoreBasedAuthCredentials": "SecretStoreBasedAuthCredentials"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class AzureBackupRecoveryPoint(_serialization.Model): - """Azure backup recoveryPoint. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBackupDiscreteRecoveryPoint - - All required parameters must be populated in order to send to server. - - :ivar object_type: Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"AzureBackupDiscreteRecoveryPoint": "AzureBackupDiscreteRecoveryPoint"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): # pylint: disable=too-many-instance-attributes - """Azure backup discrete RecoveryPoint. - - 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 server. - - :ivar object_type: Required. - :vartype object_type: str - :ivar friendly_name: - :vartype friendly_name: str - :ivar recovery_point_data_stores_details: - :vartype recovery_point_data_stores_details: - list[~azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails] - :ivar recovery_point_time: Required. - :vartype recovery_point_time: ~datetime.datetime - :ivar policy_name: - :vartype policy_name: str - :ivar policy_version: - :vartype policy_version: str - :ivar recovery_point_id: - :vartype recovery_point_id: str - :ivar recovery_point_type: - :vartype recovery_point_type: str - :ivar retention_tag_name: - :vartype retention_tag_name: str - :ivar retention_tag_version: - :vartype retention_tag_version: str - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar recovery_point_state: Specifies recovery point completeness. Partial (i.e., only some of - the intended items were backed up), or Completed (i.e., ALL intended items were backed up). - Known values are: "Completed" and "Partial". - :vartype recovery_point_state: str or - ~azure.mgmt.dataprotection.models.RecoveryPointCompletionState - """ - - _validation = { - "object_type": {"required": True}, - "recovery_point_time": {"required": True}, - "expiry_time": {"readonly": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "friendly_name": {"key": "friendlyName", "type": "str"}, - "recovery_point_data_stores_details": { - "key": "recoveryPointDataStoresDetails", - "type": "[RecoveryPointDataStoreDetails]", - }, - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - "policy_name": {"key": "policyName", "type": "str"}, - "policy_version": {"key": "policyVersion", "type": "str"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, - "retention_tag_name": {"key": "retentionTagName", "type": "str"}, - "retention_tag_version": {"key": "retentionTagVersion", "type": "str"}, - "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, - "recovery_point_state": {"key": "recoveryPointState", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_time: datetime.datetime, - friendly_name: Optional[str] = None, - recovery_point_data_stores_details: Optional[List["_models.RecoveryPointDataStoreDetails"]] = None, - policy_name: Optional[str] = None, - policy_version: Optional[str] = None, - recovery_point_id: Optional[str] = None, - recovery_point_type: Optional[str] = None, - retention_tag_name: Optional[str] = None, - retention_tag_version: Optional[str] = None, - recovery_point_state: Optional[Union[str, "_models.RecoveryPointCompletionState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: - :paramtype friendly_name: str - :keyword recovery_point_data_stores_details: - :paramtype recovery_point_data_stores_details: - list[~azure.mgmt.dataprotection.models.RecoveryPointDataStoreDetails] - :keyword recovery_point_time: Required. - :paramtype recovery_point_time: ~datetime.datetime - :keyword policy_name: - :paramtype policy_name: str - :keyword policy_version: - :paramtype policy_version: str - :keyword recovery_point_id: - :paramtype recovery_point_id: str - :keyword recovery_point_type: - :paramtype recovery_point_type: str - :keyword retention_tag_name: - :paramtype retention_tag_name: str - :keyword retention_tag_version: - :paramtype retention_tag_version: str - :keyword recovery_point_state: Specifies recovery point completeness. Partial (i.e., only some - of the intended items were backed up), or Completed (i.e., ALL intended items were backed up). - Known values are: "Completed" and "Partial". - :paramtype recovery_point_state: str or - ~azure.mgmt.dataprotection.models.RecoveryPointCompletionState - """ - super().__init__(**kwargs) - self.object_type: str = "AzureBackupDiscreteRecoveryPoint" - self.friendly_name = friendly_name - self.recovery_point_data_stores_details = recovery_point_data_stores_details - self.recovery_point_time = recovery_point_time - self.policy_name = policy_name - self.policy_version = policy_version - self.recovery_point_id = recovery_point_id - self.recovery_point_type = recovery_point_type - self.retention_tag_name = retention_tag_name - self.retention_tag_version = retention_tag_version - self.expiry_time = None - self.recovery_point_state = recovery_point_state - - -class AzureBackupFindRestorableTimeRangesRequest(_serialization.Model): # pylint: disable=name-too-long - """List Restore Ranges Request. - - All required parameters must be populated in order to send to server. - - :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "OperationalStore", "VaultStore", and "ArchiveStore". - :vartype source_data_store_type: str or - ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType - :ivar start_time: Start time for the List Restore Ranges request. ISO 8601 format. - :vartype start_time: str - :ivar end_time: End time for the List Restore Ranges request. ISO 8601 format. - :vartype end_time: str - """ - - _validation = { - "source_data_store_type": {"required": True}, - } - - _attribute_map = { - "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "end_time": {"key": "endTime", "type": "str"}, - } - - def __init__( - self, - *, - source_data_store_type: Union[str, "_models.RestoreSourceDataStoreType"], - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "OperationalStore", "VaultStore", and "ArchiveStore". - :paramtype source_data_store_type: str or - ~azure.mgmt.dataprotection.models.RestoreSourceDataStoreType - :keyword start_time: Start time for the List Restore Ranges request. ISO 8601 format. - :paramtype start_time: str - :keyword end_time: End time for the List Restore Ranges request. ISO 8601 format. - :paramtype end_time: str - """ - super().__init__(**kwargs) - self.source_data_store_type = source_data_store_type - self.start_time = start_time - self.end_time = end_time - - -class DppWorkerRequest(_serialization.Model): - """DppWorkerRequest. - - :ivar subscription_id: - :vartype subscription_id: str - :ivar uri: - :vartype uri: str - :ivar headers: Dictionary of - . - :vartype headers: dict[str, list[str]] - :ivar supported_group_versions: - :vartype supported_group_versions: list[str] - :ivar culture_info: - :vartype culture_info: str - :ivar parameters: Dictionary of :code:``. - :vartype parameters: dict[str, str] - :ivar http_method: - :vartype http_method: str - """ - - _attribute_map = { - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, - "headers": {"key": "headers", "type": "{[str]}"}, - "supported_group_versions": {"key": "supportedGroupVersions", "type": "[str]"}, - "culture_info": {"key": "cultureInfo", "type": "str"}, - "parameters": {"key": "parameters", "type": "{str}"}, - "http_method": {"key": "httpMethod", "type": "str"}, - } - - def __init__( - self, - *, - subscription_id: Optional[str] = None, - uri: Optional[str] = None, - headers: Optional[Dict[str, List[str]]] = None, - supported_group_versions: Optional[List[str]] = None, - culture_info: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, - http_method: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword subscription_id: - :paramtype subscription_id: str - :keyword uri: - :paramtype uri: str - :keyword headers: Dictionary of - . - :paramtype headers: dict[str, list[str]] - :keyword supported_group_versions: - :paramtype supported_group_versions: list[str] - :keyword culture_info: - :paramtype culture_info: str - :keyword parameters: Dictionary of :code:``. - :paramtype parameters: dict[str, str] - :keyword http_method: - :paramtype http_method: str - """ - super().__init__(**kwargs) - self.subscription_id = subscription_id - self.uri = uri - self.headers = headers - self.supported_group_versions = supported_group_versions - self.culture_info = culture_info - self.parameters = parameters - self.http_method = http_method - - -class AzureBackupFindRestorableTimeRangesRequestResource(DppWorkerRequest): # pylint: disable=name-too-long - """List Restore Ranges Request. - - :ivar subscription_id: - :vartype subscription_id: str - :ivar uri: - :vartype uri: str - :ivar headers: Dictionary of - . - :vartype headers: dict[str, list[str]] - :ivar supported_group_versions: - :vartype supported_group_versions: list[str] - :ivar culture_info: - :vartype culture_info: str - :ivar parameters: Dictionary of :code:``. - :vartype parameters: dict[str, str] - :ivar http_method: - :vartype http_method: str - :ivar content: AzureBackupFindRestorableTimeRangesRequestResource content. - :vartype content: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - """ - - _attribute_map = { - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, - "headers": {"key": "headers", "type": "{[str]}"}, - "supported_group_versions": {"key": "supportedGroupVersions", "type": "[str]"}, - "culture_info": {"key": "cultureInfo", "type": "str"}, - "parameters": {"key": "parameters", "type": "{str}"}, - "http_method": {"key": "httpMethod", "type": "str"}, - "content": {"key": "content", "type": "AzureBackupFindRestorableTimeRangesRequest"}, - } - - def __init__( - self, - *, - subscription_id: Optional[str] = None, - uri: Optional[str] = None, - headers: Optional[Dict[str, List[str]]] = None, - supported_group_versions: Optional[List[str]] = None, - culture_info: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, - http_method: Optional[str] = None, - content: Optional["_models.AzureBackupFindRestorableTimeRangesRequest"] = None, - **kwargs: Any - ) -> None: - """ - :keyword subscription_id: - :paramtype subscription_id: str - :keyword uri: - :paramtype uri: str - :keyword headers: Dictionary of - . - :paramtype headers: dict[str, list[str]] - :keyword supported_group_versions: - :paramtype supported_group_versions: list[str] - :keyword culture_info: - :paramtype culture_info: str - :keyword parameters: Dictionary of :code:``. - :paramtype parameters: dict[str, str] - :keyword http_method: - :paramtype http_method: str - :keyword content: AzureBackupFindRestorableTimeRangesRequestResource content. - :paramtype content: - ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - """ - super().__init__( - subscription_id=subscription_id, - uri=uri, - headers=headers, - supported_group_versions=supported_group_versions, - culture_info=culture_info, - parameters=parameters, - http_method=http_method, - **kwargs - ) - self.content = content - - -class AzureBackupFindRestorableTimeRangesResponse(_serialization.Model): # pylint: disable=name-too-long - """List Restore Ranges Response. - - :ivar restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. - :vartype restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] - :ivar object_type: - :vartype object_type: str - """ - - _attribute_map = { - "restorable_time_ranges": {"key": "restorableTimeRanges", "type": "[RestorableTimeRange]"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__( - self, - *, - restorable_time_ranges: Optional[List["_models.RestorableTimeRange"]] = None, - object_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword restorable_time_ranges: Returns the Restore Ranges available on the Backup Instance. - :paramtype restorable_time_ranges: list[~azure.mgmt.dataprotection.models.RestorableTimeRange] - :keyword object_type: - :paramtype object_type: str - """ - super().__init__(**kwargs) - self.restorable_time_ranges = restorable_time_ranges - self.object_type = object_type - - -class DppResource(_serialization.Model): - """Resource class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class AzureBackupFindRestorableTimeRangesResponseResource(DppResource): # pylint: disable=name-too-long - """List Restore Ranges Response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: AzureBackupFindRestorableTimeRangesResponseResource properties. - :vartype properties: - ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "AzureBackupFindRestorableTimeRangesResponse"}, - } - - def __init__( - self, *, properties: Optional["_models.AzureBackupFindRestorableTimeRangesResponse"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: AzureBackupFindRestorableTimeRangesResponseResource properties. - :paramtype properties: - ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponse - """ - super().__init__(**kwargs) - self.properties = properties - - -class AzureBackupJob(_serialization.Model): # pylint: disable=too-many-instance-attributes - """AzureBackup Job Class. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar activity_id: Job Activity Id. Required. - :vartype activity_id: str - :ivar backup_instance_friendly_name: Name of the Backup Instance. Required. - :vartype backup_instance_friendly_name: str - :ivar backup_instance_id: ARM ID of the Backup Instance. - :vartype backup_instance_id: str - :ivar data_source_id: ARM ID of the DataSource. Required. - :vartype data_source_id: str - :ivar data_source_location: Location of the DataSource. Required. - :vartype data_source_location: str - :ivar data_source_name: User Friendly Name of the DataSource. Required. - :vartype data_source_name: str - :ivar data_source_set_name: Data Source Set Name of the DataSource. - :vartype data_source_set_name: str - :ivar data_source_type: Type of DataSource. Required. - :vartype data_source_type: str - :ivar duration: Total run time of the job. ISO 8601 format. - :vartype duration: str - :ivar end_time: EndTime of the job(in UTC). - :vartype end_time: ~datetime.datetime - :ivar error_details: A List, detailing the errors related to the job. - :vartype error_details: list[~azure.mgmt.dataprotection.models.UserFacingError] - :ivar extended_info: Extended Information about the job. - :vartype extended_info: ~azure.mgmt.dataprotection.models.JobExtendedInfo - :ivar is_user_triggered: Indicated that whether the job is adhoc(true) or scheduled(false). - Required. - :vartype is_user_triggered: bool - :ivar operation: It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; - Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. Required. - :vartype operation: str - :ivar operation_category: It indicates the type of Job i.e. Backup/Restore/Tiering/Management. - Required. - :vartype operation_category: str - :ivar policy_id: ARM ID of the policy. - :vartype policy_id: str - :ivar policy_name: Name of the policy. - :vartype policy_name: str - :ivar progress_enabled: Indicated whether progress is enabled for the job. Required. - :vartype progress_enabled: bool - :ivar progress_url: Url which contains job's progress. - :vartype progress_url: str - :ivar rehydration_priority: Priority to be used for rehydration. - :vartype rehydration_priority: str - :ivar restore_type: It indicates the sub type of operation i.e. in case of Restore it can be - ALR/OLR. - :vartype restore_type: str - :ivar source_resource_group: Resource Group Name of the Datasource. Required. - :vartype source_resource_group: str - :ivar source_subscription_id: SubscriptionId corresponding to the DataSource. Required. - :vartype source_subscription_id: str - :ivar start_time: StartTime of the job(in UTC). Required. - :vartype start_time: ~datetime.datetime - :ivar status: Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. - Required. - :vartype status: str - :ivar subscription_id: Subscription Id of the corresponding backup vault. Required. - :vartype subscription_id: str - :ivar supported_actions: List of supported actions. Required. - :vartype supported_actions: list[str] - :ivar vault_name: Name of the vault. Required. - :vartype vault_name: str - :ivar etag: - :vartype etag: str - :ivar source_data_store_name: - :vartype source_data_store_name: str - :ivar destination_data_store_name: - :vartype destination_data_store_name: str - """ - - _validation = { - "activity_id": {"required": True}, - "backup_instance_friendly_name": {"required": True}, - "backup_instance_id": {"readonly": True}, - "data_source_id": {"required": True}, - "data_source_location": {"required": True}, - "data_source_name": {"required": True}, - "data_source_type": {"required": True}, - "end_time": {"readonly": True}, - "error_details": {"readonly": True}, - "extended_info": {"readonly": True}, - "is_user_triggered": {"required": True}, - "operation": {"required": True}, - "operation_category": {"required": True}, - "policy_id": {"readonly": True}, - "policy_name": {"readonly": True}, - "progress_enabled": {"required": True}, - "progress_url": {"readonly": True}, - "rehydration_priority": {"readonly": True}, - "restore_type": {"readonly": True}, - "source_resource_group": {"required": True}, - "source_subscription_id": {"required": True}, - "start_time": {"required": True}, - "status": {"required": True}, - "subscription_id": {"required": True}, - "supported_actions": {"required": True}, - "vault_name": {"required": True}, - } - - _attribute_map = { - "activity_id": {"key": "activityID", "type": "str"}, - "backup_instance_friendly_name": {"key": "backupInstanceFriendlyName", "type": "str"}, - "backup_instance_id": {"key": "backupInstanceId", "type": "str"}, - "data_source_id": {"key": "dataSourceId", "type": "str"}, - "data_source_location": {"key": "dataSourceLocation", "type": "str"}, - "data_source_name": {"key": "dataSourceName", "type": "str"}, - "data_source_set_name": {"key": "dataSourceSetName", "type": "str"}, - "data_source_type": {"key": "dataSourceType", "type": "str"}, - "duration": {"key": "duration", "type": "str"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "error_details": {"key": "errorDetails", "type": "[UserFacingError]"}, - "extended_info": {"key": "extendedInfo", "type": "JobExtendedInfo"}, - "is_user_triggered": {"key": "isUserTriggered", "type": "bool"}, - "operation": {"key": "operation", "type": "str"}, - "operation_category": {"key": "operationCategory", "type": "str"}, - "policy_id": {"key": "policyId", "type": "str"}, - "policy_name": {"key": "policyName", "type": "str"}, - "progress_enabled": {"key": "progressEnabled", "type": "bool"}, - "progress_url": {"key": "progressUrl", "type": "str"}, - "rehydration_priority": {"key": "rehydrationPriority", "type": "str"}, - "restore_type": {"key": "restoreType", "type": "str"}, - "source_resource_group": {"key": "sourceResourceGroup", "type": "str"}, - "source_subscription_id": {"key": "sourceSubscriptionID", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "status": {"key": "status", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "supported_actions": {"key": "supportedActions", "type": "[str]"}, - "vault_name": {"key": "vaultName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "source_data_store_name": {"key": "sourceDataStoreName", "type": "str"}, - "destination_data_store_name": {"key": "destinationDataStoreName", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - activity_id: str, - backup_instance_friendly_name: str, - data_source_id: str, - data_source_location: str, - data_source_name: str, - data_source_type: str, - is_user_triggered: bool, - operation: str, - operation_category: str, - progress_enabled: bool, - source_resource_group: str, - source_subscription_id: str, - start_time: datetime.datetime, - status: str, - subscription_id: str, - supported_actions: List[str], - vault_name: str, - data_source_set_name: Optional[str] = None, - duration: Optional[str] = None, - etag: Optional[str] = None, - source_data_store_name: Optional[str] = None, - destination_data_store_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword activity_id: Job Activity Id. Required. - :paramtype activity_id: str - :keyword backup_instance_friendly_name: Name of the Backup Instance. Required. - :paramtype backup_instance_friendly_name: str - :keyword data_source_id: ARM ID of the DataSource. Required. - :paramtype data_source_id: str - :keyword data_source_location: Location of the DataSource. Required. - :paramtype data_source_location: str - :keyword data_source_name: User Friendly Name of the DataSource. Required. - :paramtype data_source_name: str - :keyword data_source_set_name: Data Source Set Name of the DataSource. - :paramtype data_source_set_name: str - :keyword data_source_type: Type of DataSource. Required. - :paramtype data_source_type: str - :keyword duration: Total run time of the job. ISO 8601 format. - :paramtype duration: str - :keyword is_user_triggered: Indicated that whether the job is adhoc(true) or scheduled(false). - Required. - :paramtype is_user_triggered: bool - :keyword operation: It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; - Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure. Required. - :paramtype operation: str - :keyword operation_category: It indicates the type of Job i.e. - Backup/Restore/Tiering/Management. Required. - :paramtype operation_category: str - :keyword progress_enabled: Indicated whether progress is enabled for the job. Required. - :paramtype progress_enabled: bool - :keyword source_resource_group: Resource Group Name of the Datasource. Required. - :paramtype source_resource_group: str - :keyword source_subscription_id: SubscriptionId corresponding to the DataSource. Required. - :paramtype source_subscription_id: str - :keyword start_time: StartTime of the job(in UTC). Required. - :paramtype start_time: ~datetime.datetime - :keyword status: Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning. - Required. - :paramtype status: str - :keyword subscription_id: Subscription Id of the corresponding backup vault. Required. - :paramtype subscription_id: str - :keyword supported_actions: List of supported actions. Required. - :paramtype supported_actions: list[str] - :keyword vault_name: Name of the vault. Required. - :paramtype vault_name: str - :keyword etag: - :paramtype etag: str - :keyword source_data_store_name: - :paramtype source_data_store_name: str - :keyword destination_data_store_name: - :paramtype destination_data_store_name: str - """ - super().__init__(**kwargs) - self.activity_id = activity_id - self.backup_instance_friendly_name = backup_instance_friendly_name - self.backup_instance_id = None - self.data_source_id = data_source_id - self.data_source_location = data_source_location - self.data_source_name = data_source_name - self.data_source_set_name = data_source_set_name - self.data_source_type = data_source_type - self.duration = duration - self.end_time = None - self.error_details = None - self.extended_info = None - self.is_user_triggered = is_user_triggered - self.operation = operation - self.operation_category = operation_category - self.policy_id = None - self.policy_name = None - self.progress_enabled = progress_enabled - self.progress_url = None - self.rehydration_priority = None - self.restore_type = None - self.source_resource_group = source_resource_group - self.source_subscription_id = source_subscription_id - self.start_time = start_time - self.status = status - self.subscription_id = subscription_id - self.supported_actions = supported_actions - self.vault_name = vault_name - self.etag = etag - self.source_data_store_name = source_data_store_name - self.destination_data_store_name = destination_data_store_name - - -class AzureBackupJobResource(DppResource): - """AzureBackup Job Resource Class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: AzureBackupJobResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.AzureBackupJob - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "AzureBackupJob"}, - } - - def __init__(self, *, properties: Optional["_models.AzureBackupJob"] = None, **kwargs: Any) -> None: - """ - :keyword properties: AzureBackupJobResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.AzureBackupJob - """ - super().__init__(**kwargs) - self.properties = properties - - -class DppResourceList(_serialization.Model): - """ListResource. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.next_link = next_link - - -class AzureBackupJobResourceList(DppResourceList): - """List of AzureBackup Job resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[AzureBackupJobResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.AzureBackupJobResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class BackupParameters(_serialization.Model): - """BackupParameters base. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBackupParams - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"AzureBackupParams": "AzureBackupParams"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class AzureBackupParams(BackupParameters): - """Azure backup parameters. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar backup_type: BackupType ; Full/Incremental etc. Required. - :vartype backup_type: str - """ - - _validation = { - "object_type": {"required": True}, - "backup_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "backup_type": {"key": "backupType", "type": "str"}, - } - - def __init__(self, *, backup_type: str, **kwargs: Any) -> None: - """ - :keyword backup_type: BackupType ; Full/Incremental etc. Required. - :paramtype backup_type: str - """ - super().__init__(**kwargs) - self.object_type: str = "AzureBackupParams" - self.backup_type = backup_type - - -class AzureBackupRestoreRequest(_serialization.Model): - """Azure backup restore request. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBackupRecoveryPointBasedRestoreRequest, AzureBackupRecoveryTimeBasedRestoreRequest - - All required parameters must be populated in order to send to server. - - :ivar object_type: Required. - :vartype object_type: str - :ivar restore_target_info: Gets or sets the restore target information. Required. - :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is - being recovered. - :vartype source_resource_id: str - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - """ - - _validation = { - "object_type": {"required": True}, - "restore_target_info": {"required": True}, - "source_data_store_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, - "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, - "source_resource_id": {"key": "sourceResourceId", "type": "str"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, - } - - _subtype_map = { - "object_type": { - "AzureBackupRecoveryPointBasedRestoreRequest": "AzureBackupRecoveryPointBasedRestoreRequest", - "AzureBackupRecoveryTimeBasedRestoreRequest": "AzureBackupRecoveryTimeBasedRestoreRequest", - } - } - - def __init__( - self, - *, - restore_target_info: "_models.RestoreTargetInfoBase", - source_data_store_type: Union[str, "_models.SourceDataStoreType"], - source_resource_id: Optional[str] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - identity_details: Optional["_models.IdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword restore_target_info: Gets or sets the restore target information. Required. - :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which - is being recovered. - :paramtype source_resource_id: str - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - self.restore_target_info = restore_target_info - self.source_data_store_type = source_data_store_type - self.source_resource_id = source_resource_id - self.resource_guard_operation_requests = resource_guard_operation_requests - self.identity_details = identity_details - - -class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): # pylint: disable=name-too-long - """Azure backup recoveryPoint based restore request. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBackupRestoreWithRehydrationRequest - - All required parameters must be populated in order to send to server. - - :ivar object_type: Required. - :vartype object_type: str - :ivar restore_target_info: Gets or sets the restore target information. Required. - :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is - being recovered. - :vartype source_resource_id: str - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :ivar recovery_point_id: Required. - :vartype recovery_point_id: str - """ - - _validation = { - "object_type": {"required": True}, - "restore_target_info": {"required": True}, - "source_data_store_type": {"required": True}, - "recovery_point_id": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, - "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, - "source_resource_id": {"key": "sourceResourceId", "type": "str"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - } - - _subtype_map = { - "object_type": {"AzureBackupRestoreWithRehydrationRequest": "AzureBackupRestoreWithRehydrationRequest"} - } - - def __init__( - self, - *, - restore_target_info: "_models.RestoreTargetInfoBase", - source_data_store_type: Union[str, "_models.SourceDataStoreType"], - recovery_point_id: str, - source_resource_id: Optional[str] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - identity_details: Optional["_models.IdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword restore_target_info: Gets or sets the restore target information. Required. - :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which - is being recovered. - :paramtype source_resource_id: str - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :keyword recovery_point_id: Required. - :paramtype recovery_point_id: str - """ - super().__init__( - restore_target_info=restore_target_info, - source_data_store_type=source_data_store_type, - source_resource_id=source_resource_id, - resource_guard_operation_requests=resource_guard_operation_requests, - identity_details=identity_details, - **kwargs - ) - self.object_type: str = "AzureBackupRecoveryPointBasedRestoreRequest" - self.recovery_point_id = recovery_point_id - - -class AzureBackupRecoveryPointResource(DppResource): - """Azure backup recoveryPoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: AzureBackupRecoveryPointResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "AzureBackupRecoveryPoint"}, - } - - def __init__(self, *, properties: Optional["_models.AzureBackupRecoveryPoint"] = None, **kwargs: Any) -> None: - """ - :keyword properties: AzureBackupRecoveryPointResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPoint - """ - super().__init__(**kwargs) - self.properties = properties - - -class AzureBackupRecoveryPointResourceList(DppResourceList): - """Azure backup recoveryPoint resource list. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[AzureBackupRecoveryPointResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.AzureBackupRecoveryPointResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): # pylint: disable=name-too-long - """AzureBackup RecoveryPointTime Based Restore Request. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Required. - :vartype object_type: str - :ivar restore_target_info: Gets or sets the restore target information. Required. - :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is - being recovered. - :vartype source_resource_id: str - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :ivar recovery_point_time: The recovery time in ISO 8601 format example - - 2020-08-14T17:30:00.0000000Z. Required. - :vartype recovery_point_time: str - """ - - _validation = { - "object_type": {"required": True}, - "restore_target_info": {"required": True}, - "source_data_store_type": {"required": True}, - "recovery_point_time": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, - "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, - "source_resource_id": {"key": "sourceResourceId", "type": "str"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, - "recovery_point_time": {"key": "recoveryPointTime", "type": "str"}, - } - - def __init__( - self, - *, - restore_target_info: "_models.RestoreTargetInfoBase", - source_data_store_type: Union[str, "_models.SourceDataStoreType"], - recovery_point_time: str, - source_resource_id: Optional[str] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - identity_details: Optional["_models.IdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword restore_target_info: Gets or sets the restore target information. Required. - :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which - is being recovered. - :paramtype source_resource_id: str - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :keyword recovery_point_time: The recovery time in ISO 8601 format example - - 2020-08-14T17:30:00.0000000Z. Required. - :paramtype recovery_point_time: str - """ - super().__init__( - restore_target_info=restore_target_info, - source_data_store_type=source_data_store_type, - source_resource_id=source_resource_id, - resource_guard_operation_requests=resource_guard_operation_requests, - identity_details=identity_details, - **kwargs - ) - self.object_type: str = "AzureBackupRecoveryTimeBasedRestoreRequest" - self.recovery_point_time = recovery_point_time - - -class AzureBackupRehydrationRequest(_serialization.Model): - """Azure Backup Rehydrate Request. - - All required parameters must be populated in order to send to server. - - :ivar recovery_point_id: Id of the recovery point to be recovered. Required. - :vartype recovery_point_id: str - :ivar rehydration_priority: Priority to be used for rehydration. Values High or Standard. Known - values are: "Invalid", "High", and "Standard". - :vartype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :ivar rehydration_retention_duration: Retention duration in ISO 8601 format i.e P10D . - Required. - :vartype rehydration_retention_duration: str - """ - - _validation = { - "recovery_point_id": {"required": True}, - "rehydration_retention_duration": {"required": True}, - } - - _attribute_map = { - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "rehydration_priority": {"key": "rehydrationPriority", "type": "str"}, - "rehydration_retention_duration": {"key": "rehydrationRetentionDuration", "type": "str"}, - } - - def __init__( - self, - *, - recovery_point_id: str, - rehydration_retention_duration: str, - rehydration_priority: Optional[Union[str, "_models.RehydrationPriority"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: Id of the recovery point to be recovered. Required. - :paramtype recovery_point_id: str - :keyword rehydration_priority: Priority to be used for rehydration. Values High or Standard. - Known values are: "Invalid", "High", and "Standard". - :paramtype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :keyword rehydration_retention_duration: Retention duration in ISO 8601 format i.e P10D . - Required. - :paramtype rehydration_retention_duration: str - """ - super().__init__(**kwargs) - self.recovery_point_id = recovery_point_id - self.rehydration_priority = rehydration_priority - self.rehydration_retention_duration = rehydration_retention_duration - - -class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRestoreRequest): - """AzureBackup Restore with Rehydration Request. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Required. - :vartype object_type: str - :ivar restore_target_info: Gets or sets the restore target information. Required. - :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is - being recovered. - :vartype source_resource_id: str - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :ivar recovery_point_id: Required. - :vartype recovery_point_id: str - :ivar rehydration_priority: Priority to be used for rehydration. Values High or Standard. - Required. Known values are: "Invalid", "High", and "Standard". - :vartype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :ivar rehydration_retention_duration: Retention duration in ISO 8601 format i.e P10D . - Required. - :vartype rehydration_retention_duration: str - """ - - _validation = { - "object_type": {"required": True}, - "restore_target_info": {"required": True}, - "source_data_store_type": {"required": True}, - "recovery_point_id": {"required": True}, - "rehydration_priority": {"required": True}, - "rehydration_retention_duration": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "restore_target_info": {"key": "restoreTargetInfo", "type": "RestoreTargetInfoBase"}, - "source_data_store_type": {"key": "sourceDataStoreType", "type": "str"}, - "source_resource_id": {"key": "sourceResourceId", "type": "str"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, - "recovery_point_id": {"key": "recoveryPointId", "type": "str"}, - "rehydration_priority": {"key": "rehydrationPriority", "type": "str"}, - "rehydration_retention_duration": {"key": "rehydrationRetentionDuration", "type": "str"}, - } - - def __init__( - self, - *, - restore_target_info: "_models.RestoreTargetInfoBase", - source_data_store_type: Union[str, "_models.SourceDataStoreType"], - recovery_point_id: str, - rehydration_priority: Union[str, "_models.RehydrationPriority"], - rehydration_retention_duration: str, - source_resource_id: Optional[str] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - identity_details: Optional["_models.IdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword restore_target_info: Gets or sets the restore target information. Required. - :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase - :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". - :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType - :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which - is being recovered. - :paramtype source_resource_id: str - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :keyword recovery_point_id: Required. - :paramtype recovery_point_id: str - :keyword rehydration_priority: Priority to be used for rehydration. Values High or Standard. - Required. Known values are: "Invalid", "High", and "Standard". - :paramtype rehydration_priority: str or ~azure.mgmt.dataprotection.models.RehydrationPriority - :keyword rehydration_retention_duration: Retention duration in ISO 8601 format i.e P10D . - Required. - :paramtype rehydration_retention_duration: str - """ - super().__init__( - restore_target_info=restore_target_info, - source_data_store_type=source_data_store_type, - source_resource_id=source_resource_id, - resource_guard_operation_requests=resource_guard_operation_requests, - identity_details=identity_details, - recovery_point_id=recovery_point_id, - **kwargs - ) - self.object_type: str = "AzureBackupRestoreWithRehydrationRequest" - self.rehydration_priority = rehydration_priority - self.rehydration_retention_duration = rehydration_retention_duration - - -class BasePolicyRule(_serialization.Model): - """BasePolicy Rule. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBackupRule, AzureRetentionRule - - All required parameters must be populated in order to send to server. - - :ivar name: Required. - :vartype name: str - :ivar object_type: Required. - :vartype object_type: str - """ - - _validation = { - "name": {"required": True}, - "object_type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"AzureBackupRule": "AzureBackupRule", "AzureRetentionRule": "AzureRetentionRule"}} - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.object_type: Optional[str] = None - - -class AzureBackupRule(BasePolicyRule): - """Azure backup rule. - - All required parameters must be populated in order to send to server. - - :ivar name: Required. - :vartype name: str - :ivar object_type: Required. - :vartype object_type: str - :ivar backup_parameters: BackupParameters base. - :vartype backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters - :ivar data_store: DataStoreInfo base. Required. - :vartype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :ivar trigger: Trigger context. Required. - :vartype trigger: ~azure.mgmt.dataprotection.models.TriggerContext - """ - - _validation = { - "name": {"required": True}, - "object_type": {"required": True}, - "data_store": {"required": True}, - "trigger": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - "backup_parameters": {"key": "backupParameters", "type": "BackupParameters"}, - "data_store": {"key": "dataStore", "type": "DataStoreInfoBase"}, - "trigger": {"key": "trigger", "type": "TriggerContext"}, - } - - def __init__( - self, - *, - name: str, - data_store: "_models.DataStoreInfoBase", - trigger: "_models.TriggerContext", - backup_parameters: Optional["_models.BackupParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Required. - :paramtype name: str - :keyword backup_parameters: BackupParameters base. - :paramtype backup_parameters: ~azure.mgmt.dataprotection.models.BackupParameters - :keyword data_store: DataStoreInfo base. Required. - :paramtype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :keyword trigger: Trigger context. Required. - :paramtype trigger: ~azure.mgmt.dataprotection.models.TriggerContext - """ - super().__init__(name=name, **kwargs) - self.object_type: str = "AzureBackupRule" - self.backup_parameters = backup_parameters - self.data_store = data_store - self.trigger = trigger - - -class AzureMonitorAlertSettings(_serialization.Model): - """Settings for Azure Monitor based alerts. - - :ivar alerts_for_all_job_failures: Known values are: "Enabled" and "Disabled". - :vartype alerts_for_all_job_failures: str or ~azure.mgmt.dataprotection.models.AlertsState - """ - - _attribute_map = { - "alerts_for_all_job_failures": {"key": "alertsForAllJobFailures", "type": "str"}, - } - - def __init__( - self, *, alerts_for_all_job_failures: Optional[Union[str, "_models.AlertsState"]] = None, **kwargs: Any - ) -> None: - """ - :keyword alerts_for_all_job_failures: Known values are: "Enabled" and "Disabled". - :paramtype alerts_for_all_job_failures: str or ~azure.mgmt.dataprotection.models.AlertsState - """ - super().__init__(**kwargs) - self.alerts_for_all_job_failures = alerts_for_all_job_failures - - -class DataStoreParameters(_serialization.Model): - """Parameters for DataStore. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureOperationalStoreParameters - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values - are: "OperationalStore", "VaultStore", and "ArchiveStore". - :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - """ - - _validation = { - "object_type": {"required": True}, - "data_store_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "data_store_type": {"key": "dataStoreType", "type": "str"}, - } - - _subtype_map = {"object_type": {"AzureOperationalStoreParameters": "AzureOperationalStoreParameters"}} - - def __init__(self, *, data_store_type: Union[str, "_models.DataStoreTypes"], **kwargs: Any) -> None: - """ - :keyword data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values - are: "OperationalStore", "VaultStore", and "ArchiveStore". - :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - self.data_store_type = data_store_type - - -class AzureOperationalStoreParameters(DataStoreParameters): - """Parameters for Operational-Tier DataStore. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values - are: "OperationalStore", "VaultStore", and "ArchiveStore". - :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :ivar resource_group_id: Gets or sets the Snapshot Resource Group Uri. - :vartype resource_group_id: str - """ - - _validation = { - "object_type": {"required": True}, - "data_store_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "data_store_type": {"key": "dataStoreType", "type": "str"}, - "resource_group_id": {"key": "resourceGroupId", "type": "str"}, - } - - def __init__( - self, - *, - data_store_type: Union[str, "_models.DataStoreTypes"], - resource_group_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values - are: "OperationalStore", "VaultStore", and "ArchiveStore". - :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :keyword resource_group_id: Gets or sets the Snapshot Resource Group Uri. - :paramtype resource_group_id: str - """ - super().__init__(data_store_type=data_store_type, **kwargs) - self.object_type: str = "AzureOperationalStoreParameters" - self.resource_group_id = resource_group_id - - -class AzureRetentionRule(BasePolicyRule): - """Azure retention rule. - - All required parameters must be populated in order to send to server. - - :ivar name: Required. - :vartype name: str - :ivar object_type: Required. - :vartype object_type: str - :ivar is_default: - :vartype is_default: bool - :ivar lifecycles: Required. - :vartype lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] - """ - - _validation = { - "name": {"required": True}, - "object_type": {"required": True}, - "lifecycles": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - "is_default": {"key": "isDefault", "type": "bool"}, - "lifecycles": {"key": "lifecycles", "type": "[SourceLifeCycle]"}, - } - - def __init__( - self, - *, - name: str, - lifecycles: List["_models.SourceLifeCycle"], - is_default: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Required. - :paramtype name: str - :keyword is_default: - :paramtype is_default: bool - :keyword lifecycles: Required. - :paramtype lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] - """ - super().__init__(name=name, **kwargs) - self.object_type: str = "AzureRetentionRule" - self.is_default = is_default - self.lifecycles = lifecycles - - -class BackupCriteria(_serialization.Model): - """BackupCriteria base class. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ScheduleBasedBackupCriteria - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"ScheduleBasedBackupCriteria": "ScheduleBasedBackupCriteria"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class BackupDatasourceParameters(_serialization.Model): - """Parameters for Backup Datasource. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BlobBackupDatasourceParameters, KubernetesClusterBackupDatasourceParameters - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = { - "object_type": { - "BlobBackupDatasourceParameters": "BlobBackupDatasourceParameters", - "KubernetesClusterBackupDatasourceParameters": "KubernetesClusterBackupDatasourceParameters", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class BackupInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Backup Instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar friendly_name: Gets or sets the Backup Instance friendly name. - :vartype friendly_name: str - :ivar data_source_info: Gets or sets the data source information. Required. - :vartype data_source_info: ~azure.mgmt.dataprotection.models.Datasource - :ivar data_source_set_info: Gets or sets the data source set information. - :vartype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :ivar policy_info: Gets or sets the policy information. Required. - :vartype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar protection_status: Specifies the protection status of the resource. - :vartype protection_status: ~azure.mgmt.dataprotection.models.ProtectionStatusDetails - :ivar current_protection_state: Specifies the current protection state of the resource. Known - values are: "Invalid", "NotProtected", "ConfiguringProtection", "ProtectionConfigured", - "BackupSchedulesSuspended", "RetentionSchedulesSuspended", "ProtectionStopped", - "ProtectionError", "ConfiguringProtectionFailed", "SoftDeleting", "SoftDeleted", and - "UpdatingProtection". - :vartype current_protection_state: str or - ~azure.mgmt.dataprotection.models.CurrentProtectionState - :ivar protection_error_details: Specifies the protection error of the resource. - :vartype protection_error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :ivar provisioning_state: Specifies the provisioning state of the resource i.e. - provisioning/updating/Succeeded/Failed. - :vartype provisioning_state: str - :ivar datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - :ivar validation_type: Specifies the type of validation. In case of DeepValidation, all - validations from /validateForBackup API will run again. Known values are: "ShallowValidation" - and "DeepValidation". - :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType - :ivar identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :ivar object_type: Required. - :vartype object_type: str - """ - - _validation = { - "data_source_info": {"required": True}, - "policy_info": {"required": True}, - "protection_status": {"readonly": True}, - "current_protection_state": {"readonly": True}, - "protection_error_details": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "object_type": {"required": True}, - } - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "data_source_info": {"key": "dataSourceInfo", "type": "Datasource"}, - "data_source_set_info": {"key": "dataSourceSetInfo", "type": "DatasourceSet"}, - "policy_info": {"key": "policyInfo", "type": "PolicyInfo"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "protection_status": {"key": "protectionStatus", "type": "ProtectionStatusDetails"}, - "current_protection_state": {"key": "currentProtectionState", "type": "str"}, - "protection_error_details": {"key": "protectionErrorDetails", "type": "UserFacingError"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "datasource_auth_credentials": {"key": "datasourceAuthCredentials", "type": "AuthCredentials"}, - "validation_type": {"key": "validationType", "type": "str"}, - "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__( - self, - *, - data_source_info: "_models.Datasource", - policy_info: "_models.PolicyInfo", - object_type: str, - friendly_name: Optional[str] = None, - data_source_set_info: Optional["_models.DatasourceSet"] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, - validation_type: Optional[Union[str, "_models.ValidationType"]] = None, - identity_details: Optional["_models.IdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: Gets or sets the Backup Instance friendly name. - :paramtype friendly_name: str - :keyword data_source_info: Gets or sets the data source information. Required. - :paramtype data_source_info: ~azure.mgmt.dataprotection.models.Datasource - :keyword data_source_set_info: Gets or sets the data source set information. - :paramtype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :keyword policy_info: Gets or sets the policy information. Required. - :paramtype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - :keyword validation_type: Specifies the type of validation. In case of DeepValidation, all - validations from /validateForBackup API will run again. Known values are: "ShallowValidation" - and "DeepValidation". - :paramtype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType - :keyword identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :keyword object_type: Required. - :paramtype object_type: str - """ - super().__init__(**kwargs) - self.friendly_name = friendly_name - self.data_source_info = data_source_info - self.data_source_set_info = data_source_set_info - self.policy_info = policy_info - self.resource_guard_operation_requests = resource_guard_operation_requests - self.protection_status = None - self.current_protection_state = None - self.protection_error_details = None - self.provisioning_state = None - self.datasource_auth_credentials = datasource_auth_credentials - self.validation_type = validation_type - self.identity_details = identity_details - self.object_type = object_type - - -class DppProxyResource(_serialization.Model): - """DppProxyResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Proxy Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Proxy Resource name associated with the resource. - :vartype name: str - :ivar type: Proxy Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar tags: Proxy Resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Proxy Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = tags - self.system_data = None - - -class BackupInstanceResource(DppProxyResource): - """BackupInstance Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Proxy Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Proxy Resource name associated with the resource. - :vartype name: str - :ivar type: Proxy Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar tags: Proxy Resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: BackupInstanceResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.BackupInstance - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "BackupInstance"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.BackupInstance"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Proxy Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: BackupInstanceResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.BackupInstance - """ - super().__init__(tags=tags, **kwargs) - self.properties = properties - - -class BackupInstanceResourceList(DppResourceList): - """BackupInstance Resource list response. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.BackupInstanceResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BackupInstanceResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.BackupInstanceResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.BackupInstanceResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class BaseBackupPolicy(_serialization.Model): - """BackupPolicy base. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BackupPolicy - - All required parameters must be populated in order to send to server. - - :ivar datasource_types: Type of datasource for the backup management. Required. - :vartype datasource_types: list[str] - :ivar object_type: Required. - :vartype object_type: str - """ - - _validation = { - "datasource_types": {"required": True}, - "object_type": {"required": True}, - } - - _attribute_map = { - "datasource_types": {"key": "datasourceTypes", "type": "[str]"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"BackupPolicy": "BackupPolicy"}} - - def __init__(self, *, datasource_types: List[str], **kwargs: Any) -> None: - """ - :keyword datasource_types: Type of datasource for the backup management. Required. - :paramtype datasource_types: list[str] - """ - super().__init__(**kwargs) - self.datasource_types = datasource_types - self.object_type: Optional[str] = None - - -class BackupPolicy(BaseBackupPolicy): - """Rule based backup policy. - - All required parameters must be populated in order to send to server. - - :ivar datasource_types: Type of datasource for the backup management. Required. - :vartype datasource_types: list[str] - :ivar object_type: Required. - :vartype object_type: str - :ivar policy_rules: Policy rule dictionary that contains rules for each backuptype i.e - Full/Incremental/Logs etc. Required. - :vartype policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] - """ - - _validation = { - "datasource_types": {"required": True}, - "object_type": {"required": True}, - "policy_rules": {"required": True}, - } - - _attribute_map = { - "datasource_types": {"key": "datasourceTypes", "type": "[str]"}, - "object_type": {"key": "objectType", "type": "str"}, - "policy_rules": {"key": "policyRules", "type": "[BasePolicyRule]"}, - } - - def __init__( - self, *, datasource_types: List[str], policy_rules: List["_models.BasePolicyRule"], **kwargs: Any - ) -> None: - """ - :keyword datasource_types: Type of datasource for the backup management. Required. - :paramtype datasource_types: list[str] - :keyword policy_rules: Policy rule dictionary that contains rules for each backuptype i.e - Full/Incremental/Logs etc. Required. - :paramtype policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] - """ - super().__init__(datasource_types=datasource_types, **kwargs) - self.object_type: str = "BackupPolicy" - self.policy_rules = policy_rules - - -class BackupSchedule(_serialization.Model): - """Schedule for backup. - - All required parameters must be populated in order to send to server. - - :ivar repeating_time_intervals: ISO 8601 repeating time interval format. Required. - :vartype repeating_time_intervals: list[str] - :ivar time_zone: Time zone for a schedule. Example: Pacific Standard Time. - :vartype time_zone: str - """ - - _validation = { - "repeating_time_intervals": {"required": True}, - } - - _attribute_map = { - "repeating_time_intervals": {"key": "repeatingTimeIntervals", "type": "[str]"}, - "time_zone": {"key": "timeZone", "type": "str"}, - } - - def __init__(self, *, repeating_time_intervals: List[str], time_zone: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword repeating_time_intervals: ISO 8601 repeating time interval format. Required. - :paramtype repeating_time_intervals: list[str] - :keyword time_zone: Time zone for a schedule. Example: Pacific Standard Time. - :paramtype time_zone: str - """ - super().__init__(**kwargs) - self.repeating_time_intervals = repeating_time_intervals - self.time_zone = time_zone - - -class BackupVault(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Backup Vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar monitoring_settings: Monitoring Settings. - :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings - :ivar provisioning_state: Provisioning state of the BackupVault resource. Known values are: - "Failed", "Provisioning", "Succeeded", "Unknown", and "Updating". - :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState - :ivar resource_move_state: Resource move state for backup vault. Known values are: "Unknown", - "InProgress", "PrepareFailed", "CommitFailed", "Failed", "PrepareTimedout", "CommitTimedout", - "CriticalFailure", "PartialSuccess", and "MoveSucceeded". - :vartype resource_move_state: str or ~azure.mgmt.dataprotection.models.ResourceMoveState - :ivar resource_move_details: Resource move details for backup vault. - :vartype resource_move_details: ~azure.mgmt.dataprotection.models.ResourceMoveDetails - :ivar security_settings: Security Settings. - :vartype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings - :ivar storage_settings: Storage Settings. Required. - :vartype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] - :ivar is_vault_protected_by_resource_guard: Is vault protected by resource guard. - :vartype is_vault_protected_by_resource_guard: bool - :ivar feature_settings: Feature Settings. - :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings - :ivar secure_score: Secure Score of Backup Vault. Known values are: "None", "Minimum", - "Adequate", "Maximum", and "NotSupported". - :vartype secure_score: str or ~azure.mgmt.dataprotection.models.SecureScoreLevel - :ivar bcdr_security_level: Security Level of Backup Vault. Known values are: "Poor", "Fair", - "Good", "Excellent", and "NotSupported". - :vartype bcdr_security_level: str or ~azure.mgmt.dataprotection.models.BCDRSecurityLevel - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar replicated_regions: List of replicated regions for Backup Vault. - :vartype replicated_regions: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "resource_move_state": {"readonly": True}, - "resource_move_details": {"readonly": True}, - "storage_settings": {"required": True}, - "is_vault_protected_by_resource_guard": {"readonly": True}, - "secure_score": {"readonly": True}, - "bcdr_security_level": {"readonly": True}, - } - - _attribute_map = { - "monitoring_settings": {"key": "monitoringSettings", "type": "MonitoringSettings"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "resource_move_state": {"key": "resourceMoveState", "type": "str"}, - "resource_move_details": {"key": "resourceMoveDetails", "type": "ResourceMoveDetails"}, - "security_settings": {"key": "securitySettings", "type": "SecuritySettings"}, - "storage_settings": {"key": "storageSettings", "type": "[StorageSetting]"}, - "is_vault_protected_by_resource_guard": {"key": "isVaultProtectedByResourceGuard", "type": "bool"}, - "feature_settings": {"key": "featureSettings", "type": "FeatureSettings"}, - "secure_score": {"key": "secureScore", "type": "str"}, - "bcdr_security_level": {"key": "bcdrSecurityLevel", "type": "str"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "replicated_regions": {"key": "replicatedRegions", "type": "[str]"}, - } - - def __init__( - self, - *, - storage_settings: List["_models.StorageSetting"], - monitoring_settings: Optional["_models.MonitoringSettings"] = None, - security_settings: Optional["_models.SecuritySettings"] = None, - feature_settings: Optional["_models.FeatureSettings"] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - replicated_regions: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword monitoring_settings: Monitoring Settings. - :paramtype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings - :keyword security_settings: Security Settings. - :paramtype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings - :keyword storage_settings: Storage Settings. Required. - :paramtype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] - :keyword feature_settings: Feature Settings. - :paramtype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword replicated_regions: List of replicated regions for Backup Vault. - :paramtype replicated_regions: list[str] - """ - super().__init__(**kwargs) - self.monitoring_settings = monitoring_settings - self.provisioning_state = None - self.resource_move_state = None - self.resource_move_details = None - self.security_settings = security_settings - self.storage_settings = storage_settings - self.is_vault_protected_by_resource_guard = None - self.feature_settings = feature_settings - self.secure_score = None - self.bcdr_security_level = None - self.resource_guard_operation_requests = resource_guard_operation_requests - self.replicated_regions = replicated_regions - - -class DppBaseTrackedResource(_serialization.Model): - """DppBaseTrackedResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar e_tag: Optional ETag. - :vartype e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar location: Resource location. - :vartype location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "e_tag": {"key": "eTag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, - *, - e_tag: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword e_tag: Optional ETag. - :paramtype e_tag: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.e_tag = e_tag - self.id = None - self.location = location - self.name = None - self.tags = tags - self.type = None - self.system_data = None - - -class DppTrackedResource(DppBaseTrackedResource): - """DppTrackedResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar e_tag: Optional ETag. - :vartype e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar location: Resource location. - :vartype location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar identity: Input Managed Identity Details. - :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "e_tag": {"key": "eTag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "DppIdentityDetails"}, - } - - def __init__( - self, - *, - e_tag: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.DppIdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword e_tag: Optional ETag. - :paramtype e_tag: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Input Managed Identity Details. - :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - """ - super().__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) - self.identity = identity - - -class BackupVaultResource(DppTrackedResource): - """Backup Vault Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar e_tag: Optional ETag. - :vartype e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar location: Resource location. - :vartype location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar identity: Input Managed Identity Details. - :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :ivar properties: BackupVaultResource properties. Required. - :vartype properties: ~azure.mgmt.dataprotection.models.BackupVault - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, - } - - _attribute_map = { - "e_tag": {"key": "eTag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "DppIdentityDetails"}, - "properties": {"key": "properties", "type": "BackupVault"}, - } - - def __init__( - self, - *, - properties: "_models.BackupVault", - e_tag: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.DppIdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword e_tag: Optional ETag. - :paramtype e_tag: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Input Managed Identity Details. - :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :keyword properties: BackupVaultResource properties. Required. - :paramtype properties: ~azure.mgmt.dataprotection.models.BackupVault - """ - super().__init__(e_tag=e_tag, location=location, tags=tags, identity=identity, **kwargs) - self.properties = properties - - -class BackupVaultResourceList(DppResourceList): - """List of BackupVault resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.BackupVaultResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BackupVaultResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.BackupVaultResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.BackupVaultResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class BaseBackupPolicyResource(DppResource): - """BaseBackupPolicy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: BaseBackupPolicyResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "BaseBackupPolicy"}, - } - - def __init__(self, *, properties: Optional["_models.BaseBackupPolicy"] = None, **kwargs: Any) -> None: - """ - :keyword properties: BaseBackupPolicyResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.BaseBackupPolicy - """ - super().__init__(**kwargs) - self.properties = properties - - -class BaseBackupPolicyResourceList(DppResourceList): - """List of BaseBackupPolicy resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BaseBackupPolicyResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.BaseBackupPolicyResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class BaseResourceProperties(_serialization.Model): - """Properties which are specific to datasource/datasourceSets. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DefaultResourceProperties - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - "DefaultResourceProperties" - :vartype object_type: str or ~azure.mgmt.dataprotection.models.ResourcePropertiesObjectType - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"DefaultResourceProperties": "DefaultResourceProperties"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class BlobBackupDatasourceParameters(BackupDatasourceParameters): - """Parameters to be used during configuration of backup of blobs. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar containers_list: List of containers to be backed up during configuration of backup of - blobs. Required. - :vartype containers_list: list[str] - """ - - _validation = { - "object_type": {"required": True}, - "containers_list": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "containers_list": {"key": "containersList", "type": "[str]"}, - } - - def __init__(self, *, containers_list: List[str], **kwargs: Any) -> None: - """ - :keyword containers_list: List of containers to be backed up during configuration of backup of - blobs. Required. - :paramtype containers_list: list[str] - """ - super().__init__(**kwargs) - self.object_type: str = "BlobBackupDatasourceParameters" - self.containers_list = containers_list - - -class CheckNameAvailabilityRequest(_serialization.Model): - """CheckNameAvailability Request. - - :ivar name: Resource name for which availability needs to be checked. - :vartype name: str - :ivar type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. - :vartype type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Resource name for which availability needs to be checked. - :paramtype name: str - :keyword type: Describes the Resource type: Microsoft.DataProtection/BackupVaults. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class CheckNameAvailabilityResult(_serialization.Model): - """CheckNameAvailability Result. - - :ivar message: Gets or sets the message. - :vartype message: str - :ivar name_available: Gets or sets a value indicating whether [name available]. - :vartype name_available: bool - :ivar reason: Gets or sets the reason. - :vartype reason: str - """ - - _attribute_map = { - "message": {"key": "message", "type": "str"}, - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__( - self, - *, - message: Optional[str] = None, - name_available: Optional[bool] = None, - reason: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword message: Gets or sets the message. - :paramtype message: str - :keyword name_available: Gets or sets a value indicating whether [name available]. - :paramtype name_available: bool - :keyword reason: Gets or sets the reason. - :paramtype reason: str - """ - super().__init__(**kwargs) - self.message = message - self.name_available = name_available - self.reason = reason - - -class ClientDiscoveryDisplay(_serialization.Model): - """Localized display information of an operation. - - :ivar description: Description of the operation having details of what operation is about. - :vartype description: str - :ivar operation: Operations Name itself. - :vartype operation: str - :ivar provider: Name of the provider for display purposes. - :vartype provider: str - :ivar resource: ResourceType for which this Operation can be performed. - :vartype resource: str - """ - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - } - - def __init__( - self, - *, - description: Optional[str] = None, - operation: Optional[str] = None, - provider: Optional[str] = None, - resource: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: Description of the operation having details of what operation is about. - :paramtype description: str - :keyword operation: Operations Name itself. - :paramtype operation: str - :keyword provider: Name of the provider for display purposes. - :paramtype provider: str - :keyword resource: ResourceType for which this Operation can be performed. - :paramtype resource: str - """ - super().__init__(**kwargs) - self.description = description - self.operation = operation - self.provider = provider - self.resource = resource - - -class ClientDiscoveryForLogSpecification(_serialization.Model): - """Class to represent shoebox log specification in json client discovery. - - :ivar blob_duration: blob duration of shoebox log specification. - :vartype blob_duration: str - :ivar display_name: Localized display name. - :vartype display_name: str - :ivar name: Name for shoebox log specification. - :vartype name: str - """ - - _attribute_map = { - "blob_duration": {"key": "blobDuration", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - *, - blob_duration: Optional[str] = None, - display_name: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword blob_duration: blob duration of shoebox log specification. - :paramtype blob_duration: str - :keyword display_name: Localized display name. - :paramtype display_name: str - :keyword name: Name for shoebox log specification. - :paramtype name: str - """ - super().__init__(**kwargs) - self.blob_duration = blob_duration - self.display_name = display_name - self.name = name - - -class ClientDiscoveryForProperties(_serialization.Model): - """Class to represent shoebox properties in json client discovery. - - :ivar service_specification: Operation properties. - :vartype service_specification: - ~azure.mgmt.dataprotection.models.ClientDiscoveryForServiceSpecification - """ - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "ClientDiscoveryForServiceSpecification"}, - } - - def __init__( - self, *, service_specification: Optional["_models.ClientDiscoveryForServiceSpecification"] = None, **kwargs: Any - ) -> None: - """ - :keyword service_specification: Operation properties. - :paramtype service_specification: - ~azure.mgmt.dataprotection.models.ClientDiscoveryForServiceSpecification - """ - super().__init__(**kwargs) - self.service_specification = service_specification - - -class ClientDiscoveryForServiceSpecification(_serialization.Model): - """Class to represent shoebox service specification in json client discovery. - - :ivar log_specifications: List of log specifications of this operation. - :vartype log_specifications: - list[~azure.mgmt.dataprotection.models.ClientDiscoveryForLogSpecification] - """ - - _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[ClientDiscoveryForLogSpecification]"}, - } - - def __init__( - self, *, log_specifications: Optional[List["_models.ClientDiscoveryForLogSpecification"]] = None, **kwargs: Any - ) -> None: - """ - :keyword log_specifications: List of log specifications of this operation. - :paramtype log_specifications: - list[~azure.mgmt.dataprotection.models.ClientDiscoveryForLogSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - - -class ClientDiscoveryResponse(_serialization.Model): - """Operations List response which contains list of available APIs. - - :ivar next_link: Link to the next chunk of Response. - :vartype next_link: str - :ivar value: List of available operations. - :vartype value: list[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ClientDiscoveryValueForSingleApi]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ClientDiscoveryValueForSingleApi"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: Link to the next chunk of Response. - :paramtype next_link: str - :keyword value: List of available operations. - :paramtype value: list[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class ClientDiscoveryValueForSingleApi(_serialization.Model): - """Available operation details. - - :ivar display: Contains the localized display information for this particular operation. - :vartype display: ~azure.mgmt.dataprotection.models.ClientDiscoveryDisplay - :ivar name: Name of the Operation. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar origin: The intended executor of the operation;governs the display of the operation in - the RBAC UX and the audit logs UX. - :vartype origin: str - :ivar properties: Properties for the given operation. - :vartype properties: ~azure.mgmt.dataprotection.models.ClientDiscoveryForProperties - """ - - _attribute_map = { - "display": {"key": "display", "type": "ClientDiscoveryDisplay"}, - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "ClientDiscoveryForProperties"}, - } - - def __init__( - self, - *, - display: Optional["_models.ClientDiscoveryDisplay"] = None, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - origin: Optional[str] = None, - properties: Optional["_models.ClientDiscoveryForProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword display: Contains the localized display information for this particular operation. - :paramtype display: ~azure.mgmt.dataprotection.models.ClientDiscoveryDisplay - :keyword name: Name of the Operation. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword origin: The intended executor of the operation;governs the display of the operation in - the RBAC UX and the audit logs UX. - :paramtype origin: str - :keyword properties: Properties for the given operation. - :paramtype properties: ~azure.mgmt.dataprotection.models.ClientDiscoveryForProperties - """ - super().__init__(**kwargs) - self.display = display - self.name = name - self.is_data_action = is_data_action - self.origin = origin - self.properties = properties - - -class CmkKekIdentity(_serialization.Model): - """The details of the managed identity used for CMK. - - :ivar identity_type: The identity type. 'SystemAssigned' and 'UserAssigned' are mutually - exclusive. 'SystemAssigned' will use implicitly created managed identity. Known values are: - "SystemAssigned" and "UserAssigned". - :vartype identity_type: str or ~azure.mgmt.dataprotection.models.IdentityType - :ivar identity_id: The managed identity to be used which has access permissions to the Key - Vault. Provide a value here in case identity types: 'UserAssigned' only. - :vartype identity_id: str - """ - - _attribute_map = { - "identity_type": {"key": "identityType", "type": "str"}, - "identity_id": {"key": "identityId", "type": "str"}, - } - - def __init__( - self, - *, - identity_type: Optional[Union[str, "_models.IdentityType"]] = None, - identity_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity_type: The identity type. 'SystemAssigned' and 'UserAssigned' are mutually - exclusive. 'SystemAssigned' will use implicitly created managed identity. Known values are: - "SystemAssigned" and "UserAssigned". - :paramtype identity_type: str or ~azure.mgmt.dataprotection.models.IdentityType - :keyword identity_id: The managed identity to be used which has access permissions to the Key - Vault. Provide a value here in case identity types: 'UserAssigned' only. - :paramtype identity_id: str - """ - super().__init__(**kwargs) - self.identity_type = identity_type - self.identity_id = identity_id - - -class CmkKeyVaultProperties(_serialization.Model): - """The properties of the Key Vault which hosts CMK. - - :ivar key_uri: The key uri of the Customer Managed Key. - :vartype key_uri: str - """ - - _attribute_map = { - "key_uri": {"key": "keyUri", "type": "str"}, - } - - def __init__(self, *, key_uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword key_uri: The key uri of the Customer Managed Key. - :paramtype key_uri: str - """ - super().__init__(**kwargs) - self.key_uri = key_uri - - -class CopyOption(_serialization.Model): - """Options to copy. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CopyOnExpiryOption, CustomCopyOption, ImmediateCopyOption - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = { - "object_type": { - "CopyOnExpiryOption": "CopyOnExpiryOption", - "CustomCopyOption": "CustomCopyOption", - "ImmediateCopyOption": "ImmediateCopyOption", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class CopyOnExpiryOption(CopyOption): - """Copy on Expiry Option. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: str = "CopyOnExpiryOption" - - -class CrossRegionRestoreDetails(_serialization.Model): - """Cross Region Restore details. - - All required parameters must be populated in order to send to server. - - :ivar source_region: Required. - :vartype source_region: str - :ivar source_backup_instance_id: Required. - :vartype source_backup_instance_id: str - """ - - _validation = { - "source_region": {"required": True}, - "source_backup_instance_id": {"required": True}, - } - - _attribute_map = { - "source_region": {"key": "sourceRegion", "type": "str"}, - "source_backup_instance_id": {"key": "sourceBackupInstanceId", "type": "str"}, - } - - def __init__(self, *, source_region: str, source_backup_instance_id: str, **kwargs: Any) -> None: - """ - :keyword source_region: Required. - :paramtype source_region: str - :keyword source_backup_instance_id: Required. - :paramtype source_backup_instance_id: str - """ - super().__init__(**kwargs) - self.source_region = source_region - self.source_backup_instance_id = source_backup_instance_id - - -class CrossRegionRestoreJobRequest(_serialization.Model): - """Details of CRR Job to be fetched. - - All required parameters must be populated in order to send to server. - - :ivar source_region: Required. - :vartype source_region: str - :ivar source_backup_vault_id: Required. - :vartype source_backup_vault_id: str - :ivar job_id: Required. - :vartype job_id: str - """ - - _validation = { - "source_region": {"required": True}, - "source_backup_vault_id": {"required": True}, - "job_id": {"required": True}, - } - - _attribute_map = { - "source_region": {"key": "sourceRegion", "type": "str"}, - "source_backup_vault_id": {"key": "sourceBackupVaultId", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - } - - def __init__(self, *, source_region: str, source_backup_vault_id: str, job_id: str, **kwargs: Any) -> None: - """ - :keyword source_region: Required. - :paramtype source_region: str - :keyword source_backup_vault_id: Required. - :paramtype source_backup_vault_id: str - :keyword job_id: Required. - :paramtype job_id: str - """ - super().__init__(**kwargs) - self.source_region = source_region - self.source_backup_vault_id = source_backup_vault_id - self.job_id = job_id - - -class CrossRegionRestoreJobsRequest(_serialization.Model): - """Details of Backup Vault for which CRR Jobs are to be fetched. - - All required parameters must be populated in order to send to server. - - :ivar source_region: Required. - :vartype source_region: str - :ivar source_backup_vault_id: Required. - :vartype source_backup_vault_id: str - """ - - _validation = { - "source_region": {"required": True}, - "source_backup_vault_id": {"required": True}, - } - - _attribute_map = { - "source_region": {"key": "sourceRegion", "type": "str"}, - "source_backup_vault_id": {"key": "sourceBackupVaultId", "type": "str"}, - } - - def __init__(self, *, source_region: str, source_backup_vault_id: str, **kwargs: Any) -> None: - """ - :keyword source_region: Required. - :paramtype source_region: str - :keyword source_backup_vault_id: Required. - :paramtype source_backup_vault_id: str - """ - super().__init__(**kwargs) - self.source_region = source_region - self.source_backup_vault_id = source_backup_vault_id - - -class CrossRegionRestoreRequestObject(_serialization.Model): - """Cross Region Restore Request Object. - - All required parameters must be populated in order to send to server. - - :ivar restore_request_object: Gets or sets the restore request object. Required. - :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - :ivar cross_region_restore_details: Cross region restore details. Required. - :vartype cross_region_restore_details: - ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails - """ - - _validation = { - "restore_request_object": {"required": True}, - "cross_region_restore_details": {"required": True}, - } - - _attribute_map = { - "restore_request_object": {"key": "restoreRequestObject", "type": "AzureBackupRestoreRequest"}, - "cross_region_restore_details": {"key": "crossRegionRestoreDetails", "type": "CrossRegionRestoreDetails"}, - } - - def __init__( - self, - *, - restore_request_object: "_models.AzureBackupRestoreRequest", - cross_region_restore_details: "_models.CrossRegionRestoreDetails", - **kwargs: Any - ) -> None: - """ - :keyword restore_request_object: Gets or sets the restore request object. Required. - :paramtype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - :keyword cross_region_restore_details: Cross region restore details. Required. - :paramtype cross_region_restore_details: - ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails - """ - super().__init__(**kwargs) - self.restore_request_object = restore_request_object - self.cross_region_restore_details = cross_region_restore_details - - -class CrossRegionRestoreSettings(_serialization.Model): - """CrossRegionRestoreSettings. - - :ivar state: CrossRegionRestore state. Known values are: "Disabled" and "Enabled". - :vartype state: str or ~azure.mgmt.dataprotection.models.CrossRegionRestoreState - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Optional[Union[str, "_models.CrossRegionRestoreState"]] = None, **kwargs: Any) -> None: - """ - :keyword state: CrossRegionRestore state. Known values are: "Disabled" and "Enabled". - :paramtype state: str or ~azure.mgmt.dataprotection.models.CrossRegionRestoreState - """ - super().__init__(**kwargs) - self.state = state - - -class CrossSubscriptionRestoreSettings(_serialization.Model): - """CrossSubscriptionRestore Settings. - - :ivar state: CrossSubscriptionRestore state. Known values are: "Disabled", - "PermanentlyDisabled", and "Enabled". - :vartype state: str or ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreState - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - } - - def __init__( - self, *, state: Optional[Union[str, "_models.CrossSubscriptionRestoreState"]] = None, **kwargs: Any - ) -> None: - """ - :keyword state: CrossSubscriptionRestore state. Known values are: "Disabled", - "PermanentlyDisabled", and "Enabled". - :paramtype state: str or ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreState - """ - super().__init__(**kwargs) - self.state = state - - -class CustomCopyOption(CopyOption): - """Duration based custom options to copy. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar duration: Data copied after given timespan. - :vartype duration: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "duration": {"key": "duration", "type": "str"}, - } - - def __init__(self, *, duration: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword duration: Data copied after given timespan. - :paramtype duration: str - """ - super().__init__(**kwargs) - self.object_type: str = "CustomCopyOption" - self.duration = duration - - -class Datasource(_serialization.Model): - """Datasource to be backed up. - - All required parameters must be populated in order to send to server. - - :ivar datasource_type: DatasourceType of the resource. - :vartype datasource_type: str - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - :vartype object_type: str - :ivar resource_id: Full ARM ID of the resource. For azure resources, this is ARM ID. For non - azure resources, this will be the ID created by backup service via Fabric/Vault. Required. - :vartype resource_id: str - :ivar resource_location: Location of datasource. - :vartype resource_location: str - :ivar resource_name: Unique identifier of the resource in the context of parent. - :vartype resource_name: str - :ivar resource_type: Resource Type of Datasource. - :vartype resource_type: str - :ivar resource_uri: Uri of the resource. - :vartype resource_uri: str - :ivar resource_properties: Properties specific to data source. - :vartype resource_properties: ~azure.mgmt.dataprotection.models.BaseResourceProperties - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "datasource_type": {"key": "datasourceType", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - "resource_id": {"key": "resourceID", "type": "str"}, - "resource_location": {"key": "resourceLocation", "type": "str"}, - "resource_name": {"key": "resourceName", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "resource_uri": {"key": "resourceUri", "type": "str"}, - "resource_properties": {"key": "resourceProperties", "type": "BaseResourceProperties"}, - } - - def __init__( - self, - *, - resource_id: str, - datasource_type: Optional[str] = None, - object_type: Optional[str] = None, - resource_location: Optional[str] = None, - resource_name: Optional[str] = None, - resource_type: Optional[str] = None, - resource_uri: Optional[str] = None, - resource_properties: Optional["_models.BaseResourceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword datasource_type: DatasourceType of the resource. - :paramtype datasource_type: str - :keyword object_type: Type of Datasource object, used to initialize the right inherited type. - :paramtype object_type: str - :keyword resource_id: Full ARM ID of the resource. For azure resources, this is ARM ID. For non - azure resources, this will be the ID created by backup service via Fabric/Vault. Required. - :paramtype resource_id: str - :keyword resource_location: Location of datasource. - :paramtype resource_location: str - :keyword resource_name: Unique identifier of the resource in the context of parent. - :paramtype resource_name: str - :keyword resource_type: Resource Type of Datasource. - :paramtype resource_type: str - :keyword resource_uri: Uri of the resource. - :paramtype resource_uri: str - :keyword resource_properties: Properties specific to data source. - :paramtype resource_properties: ~azure.mgmt.dataprotection.models.BaseResourceProperties - """ - super().__init__(**kwargs) - self.datasource_type = datasource_type - self.object_type = object_type - self.resource_id = resource_id - self.resource_location = resource_location - self.resource_name = resource_name - self.resource_type = resource_type - self.resource_uri = resource_uri - self.resource_properties = resource_properties - - -class DatasourceSet(_serialization.Model): - """DatasourceSet details of datasource to be backed up. - - All required parameters must be populated in order to send to server. - - :ivar datasource_type: DatasourceType of the resource. - :vartype datasource_type: str - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - :vartype object_type: str - :ivar resource_id: Full ARM ID of the resource. For azure resources, this is ARM ID. For non - azure resources, this will be the ID created by backup service via Fabric/Vault. Required. - :vartype resource_id: str - :ivar resource_location: Location of datasource. - :vartype resource_location: str - :ivar resource_name: Unique identifier of the resource in the context of parent. - :vartype resource_name: str - :ivar resource_type: Resource Type of Datasource. - :vartype resource_type: str - :ivar resource_uri: Uri of the resource. - :vartype resource_uri: str - :ivar resource_properties: Properties specific to data source set. - :vartype resource_properties: ~azure.mgmt.dataprotection.models.BaseResourceProperties - """ - - _validation = { - "resource_id": {"required": True}, - } - - _attribute_map = { - "datasource_type": {"key": "datasourceType", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - "resource_id": {"key": "resourceID", "type": "str"}, - "resource_location": {"key": "resourceLocation", "type": "str"}, - "resource_name": {"key": "resourceName", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "resource_uri": {"key": "resourceUri", "type": "str"}, - "resource_properties": {"key": "resourceProperties", "type": "BaseResourceProperties"}, - } - - def __init__( - self, - *, - resource_id: str, - datasource_type: Optional[str] = None, - object_type: Optional[str] = None, - resource_location: Optional[str] = None, - resource_name: Optional[str] = None, - resource_type: Optional[str] = None, - resource_uri: Optional[str] = None, - resource_properties: Optional["_models.BaseResourceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword datasource_type: DatasourceType of the resource. - :paramtype datasource_type: str - :keyword object_type: Type of Datasource object, used to initialize the right inherited type. - :paramtype object_type: str - :keyword resource_id: Full ARM ID of the resource. For azure resources, this is ARM ID. For non - azure resources, this will be the ID created by backup service via Fabric/Vault. Required. - :paramtype resource_id: str - :keyword resource_location: Location of datasource. - :paramtype resource_location: str - :keyword resource_name: Unique identifier of the resource in the context of parent. - :paramtype resource_name: str - :keyword resource_type: Resource Type of Datasource. - :paramtype resource_type: str - :keyword resource_uri: Uri of the resource. - :paramtype resource_uri: str - :keyword resource_properties: Properties specific to data source set. - :paramtype resource_properties: ~azure.mgmt.dataprotection.models.BaseResourceProperties - """ - super().__init__(**kwargs) - self.datasource_type = datasource_type - self.object_type = object_type - self.resource_id = resource_id - self.resource_location = resource_location - self.resource_name = resource_name - self.resource_type = resource_type - self.resource_uri = resource_uri - self.resource_properties = resource_properties - - -class DataStoreInfoBase(_serialization.Model): - """DataStoreInfo base. - - All required parameters must be populated in order to send to server. - - :ivar data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values - are: "OperationalStore", "VaultStore", and "ArchiveStore". - :vartype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - Required. - :vartype object_type: str - """ - - _validation = { - "data_store_type": {"required": True}, - "object_type": {"required": True}, - } - - _attribute_map = { - "data_store_type": {"key": "dataStoreType", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__( - self, *, data_store_type: Union[str, "_models.DataStoreTypes"], object_type: str, **kwargs: Any - ) -> None: - """ - :keyword data_store_type: type of datastore; Operational/Vault/Archive. Required. Known values - are: "OperationalStore", "VaultStore", and "ArchiveStore". - :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes - :keyword object_type: Type of Datasource object, used to initialize the right inherited type. - Required. - :paramtype object_type: str - """ - super().__init__(**kwargs) - self.data_store_type = data_store_type - self.object_type = object_type - - -class Day(_serialization.Model): - """Day of the week. - - :ivar date: Date of the month. - :vartype date: int - :ivar is_last: Whether Date is last date of month. - :vartype is_last: bool - """ - - _attribute_map = { - "date": {"key": "date", "type": "int"}, - "is_last": {"key": "isLast", "type": "bool"}, - } - - def __init__(self, *, date: Optional[int] = None, is_last: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword date: Date of the month. - :paramtype date: int - :keyword is_last: Whether Date is last date of month. - :paramtype is_last: bool - """ - super().__init__(**kwargs) - self.date = date - self.is_last = is_last - - -class DefaultResourceProperties(BaseResourceProperties): - """Default source properties. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - "DefaultResourceProperties" - :vartype object_type: str or ~azure.mgmt.dataprotection.models.ResourcePropertiesObjectType - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: str = "DefaultResourceProperties" - - -class DeletedBackupInstance(BackupInstance): # pylint: disable=too-many-instance-attributes - """Deleted Backup Instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar friendly_name: Gets or sets the Backup Instance friendly name. - :vartype friendly_name: str - :ivar data_source_info: Gets or sets the data source information. Required. - :vartype data_source_info: ~azure.mgmt.dataprotection.models.Datasource - :ivar data_source_set_info: Gets or sets the data source set information. - :vartype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :ivar policy_info: Gets or sets the policy information. Required. - :vartype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar protection_status: Specifies the protection status of the resource. - :vartype protection_status: ~azure.mgmt.dataprotection.models.ProtectionStatusDetails - :ivar current_protection_state: Specifies the current protection state of the resource. Known - values are: "Invalid", "NotProtected", "ConfiguringProtection", "ProtectionConfigured", - "BackupSchedulesSuspended", "RetentionSchedulesSuspended", "ProtectionStopped", - "ProtectionError", "ConfiguringProtectionFailed", "SoftDeleting", "SoftDeleted", and - "UpdatingProtection". - :vartype current_protection_state: str or - ~azure.mgmt.dataprotection.models.CurrentProtectionState - :ivar protection_error_details: Specifies the protection error of the resource. - :vartype protection_error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :ivar provisioning_state: Specifies the provisioning state of the resource i.e. - provisioning/updating/Succeeded/Failed. - :vartype provisioning_state: str - :ivar datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - :ivar validation_type: Specifies the type of validation. In case of DeepValidation, all - validations from /validateForBackup API will run again. Known values are: "ShallowValidation" - and "DeepValidation". - :vartype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType - :ivar identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :vartype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :ivar object_type: Required. - :vartype object_type: str - :ivar deletion_info: Deletion info of Backup Instance. - :vartype deletion_info: ~azure.mgmt.dataprotection.models.DeletionInfo - """ - - _validation = { - "data_source_info": {"required": True}, - "policy_info": {"required": True}, - "protection_status": {"readonly": True}, - "current_protection_state": {"readonly": True}, - "protection_error_details": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "object_type": {"required": True}, - "deletion_info": {"readonly": True}, - } - - _attribute_map = { - "friendly_name": {"key": "friendlyName", "type": "str"}, - "data_source_info": {"key": "dataSourceInfo", "type": "Datasource"}, - "data_source_set_info": {"key": "dataSourceSetInfo", "type": "DatasourceSet"}, - "policy_info": {"key": "policyInfo", "type": "PolicyInfo"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "protection_status": {"key": "protectionStatus", "type": "ProtectionStatusDetails"}, - "current_protection_state": {"key": "currentProtectionState", "type": "str"}, - "protection_error_details": {"key": "protectionErrorDetails", "type": "UserFacingError"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "datasource_auth_credentials": {"key": "datasourceAuthCredentials", "type": "AuthCredentials"}, - "validation_type": {"key": "validationType", "type": "str"}, - "identity_details": {"key": "identityDetails", "type": "IdentityDetails"}, - "object_type": {"key": "objectType", "type": "str"}, - "deletion_info": {"key": "deletionInfo", "type": "DeletionInfo"}, - } - - def __init__( - self, - *, - data_source_info: "_models.Datasource", - policy_info: "_models.PolicyInfo", - object_type: str, - friendly_name: Optional[str] = None, - data_source_set_info: Optional["_models.DatasourceSet"] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, - validation_type: Optional[Union[str, "_models.ValidationType"]] = None, - identity_details: Optional["_models.IdentityDetails"] = None, - **kwargs: Any - ) -> None: - """ - :keyword friendly_name: Gets or sets the Backup Instance friendly name. - :paramtype friendly_name: str - :keyword data_source_info: Gets or sets the data source information. Required. - :paramtype data_source_info: ~azure.mgmt.dataprotection.models.Datasource - :keyword data_source_set_info: Gets or sets the data source set information. - :paramtype data_source_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :keyword policy_info: Gets or sets the policy information. Required. - :paramtype policy_info: ~azure.mgmt.dataprotection.models.PolicyInfo - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - :keyword validation_type: Specifies the type of validation. In case of DeepValidation, all - validations from /validateForBackup API will run again. Known values are: "ShallowValidation" - and "DeepValidation". - :paramtype validation_type: str or ~azure.mgmt.dataprotection.models.ValidationType - :keyword identity_details: Contains information of the Identity Details for the BI. - If it is null, default will be considered as System Assigned. - :paramtype identity_details: ~azure.mgmt.dataprotection.models.IdentityDetails - :keyword object_type: Required. - :paramtype object_type: str - """ - super().__init__( - friendly_name=friendly_name, - data_source_info=data_source_info, - data_source_set_info=data_source_set_info, - policy_info=policy_info, - resource_guard_operation_requests=resource_guard_operation_requests, - datasource_auth_credentials=datasource_auth_credentials, - validation_type=validation_type, - identity_details=identity_details, - object_type=object_type, - **kwargs - ) - self.deletion_info = None - - -class DeletedBackupInstanceResource(DppResource): - """Deleted Backup Instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: DeletedBackupInstanceResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.DeletedBackupInstance - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "DeletedBackupInstance"}, - } - - def __init__(self, *, properties: Optional["_models.DeletedBackupInstance"] = None, **kwargs: Any) -> None: - """ - :keyword properties: DeletedBackupInstanceResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.DeletedBackupInstance - """ - super().__init__(**kwargs) - self.properties = properties - - -class DeletedBackupInstanceResourceList(DppResourceList): - """List of DeletedBackupInstance resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DeletedBackupInstanceResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.DeletedBackupInstanceResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class DeletionInfo(_serialization.Model): - """Deletion Info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar deletion_time: Specifies time of deletion. - :vartype deletion_time: str - :ivar billing_end_date: Specifies billing end date. - :vartype billing_end_date: str - :ivar scheduled_purge_time: Specifies purge time. - :vartype scheduled_purge_time: str - :ivar delete_activity_id: Delete activity ID for troubleshooting purpose. - :vartype delete_activity_id: str - """ - - _validation = { - "deletion_time": {"readonly": True}, - "billing_end_date": {"readonly": True}, - "scheduled_purge_time": {"readonly": True}, - "delete_activity_id": {"readonly": True}, - } - - _attribute_map = { - "deletion_time": {"key": "deletionTime", "type": "str"}, - "billing_end_date": {"key": "billingEndDate", "type": "str"}, - "scheduled_purge_time": {"key": "scheduledPurgeTime", "type": "str"}, - "delete_activity_id": {"key": "deleteActivityID", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.deletion_time = None - self.billing_end_date = None - self.scheduled_purge_time = None - self.delete_activity_id = None - - -class DppBaseResource(_serialization.Model): - """Base resource under Microsoft.DataProtection provider namespace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DppBaseResourceList(_serialization.Model): - """Base for all lists of V2 resources. - - :ivar value: List of Dpp resources. - :vartype value: list[~azure.mgmt.dataprotection.models.DppBaseResource] - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DppBaseResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.DppBaseResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Dpp resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.DppBaseResource] - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DppIdentityDetails(_serialization.Model): - """Identity details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The object ID of the service principal object for the managed identity that - is used to grant role-based access to an Azure resource. - :vartype principal_id: str - :ivar tenant_id: A Globally Unique Identifier (GUID) that represents the Azure AD tenant where - the resource is now a member. - :vartype tenant_id: str - :ivar type: The identityType which can be either SystemAssigned, UserAssigned, - 'SystemAssigned,UserAssigned' or None. - :vartype type: str - :ivar user_assigned_identities: Gets or sets the user assigned identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.dataprotection.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The identityType which can be either SystemAssigned, UserAssigned, - 'SystemAssigned,UserAssigned' or None. - :paramtype type: str - :keyword user_assigned_identities: Gets or sets the user assigned identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.dataprotection.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class DppTrackedResourceList(_serialization.Model): - """DppTrackedResourceList. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.next_link = next_link - - -class EncryptionSettings(_serialization.Model): - """Customer Managed Key details of the resource. - - :ivar state: Encryption state of the Backup Vault. Known values are: "Enabled", "Disabled", and - "Inconsistent". - :vartype state: str or ~azure.mgmt.dataprotection.models.EncryptionState - :ivar key_vault_properties: The properties of the Key Vault which hosts CMK. - :vartype key_vault_properties: ~azure.mgmt.dataprotection.models.CmkKeyVaultProperties - :ivar kek_identity: The details of the managed identity used for CMK. - :vartype kek_identity: ~azure.mgmt.dataprotection.models.CmkKekIdentity - :ivar infrastructure_encryption: Enabling/Disabling the Double Encryption state. Known values - are: "Enabled" and "Disabled". - :vartype infrastructure_encryption: str or - ~azure.mgmt.dataprotection.models.InfrastructureEncryptionState - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "key_vault_properties": {"key": "keyVaultProperties", "type": "CmkKeyVaultProperties"}, - "kek_identity": {"key": "kekIdentity", "type": "CmkKekIdentity"}, - "infrastructure_encryption": {"key": "infrastructureEncryption", "type": "str"}, - } - - def __init__( - self, - *, - state: Optional[Union[str, "_models.EncryptionState"]] = None, - key_vault_properties: Optional["_models.CmkKeyVaultProperties"] = None, - kek_identity: Optional["_models.CmkKekIdentity"] = None, - infrastructure_encryption: Optional[Union[str, "_models.InfrastructureEncryptionState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: Encryption state of the Backup Vault. Known values are: "Enabled", "Disabled", - and "Inconsistent". - :paramtype state: str or ~azure.mgmt.dataprotection.models.EncryptionState - :keyword key_vault_properties: The properties of the Key Vault which hosts CMK. - :paramtype key_vault_properties: ~azure.mgmt.dataprotection.models.CmkKeyVaultProperties - :keyword kek_identity: The details of the managed identity used for CMK. - :paramtype kek_identity: ~azure.mgmt.dataprotection.models.CmkKekIdentity - :keyword infrastructure_encryption: Enabling/Disabling the Double Encryption state. Known - values are: "Enabled" and "Disabled". - :paramtype infrastructure_encryption: str or - ~azure.mgmt.dataprotection.models.InfrastructureEncryptionState - """ - super().__init__(**kwargs) - self.state = state - self.key_vault_properties = key_vault_properties - self.kek_identity = kek_identity - self.infrastructure_encryption = infrastructure_encryption - - -class Error(_serialization.Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.dataprotection.models.ErrorAdditionalInfo] - :ivar code: The error code. - :vartype code: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.dataprotection.models.Error] - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - """ - - _validation = { - "additional_info": {"readonly": True}, - "code": {"readonly": True}, - "details": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - } - - _attribute_map = { - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - "code": {"key": "code", "type": "str"}, - "details": {"key": "details", "type": "[Error]"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.additional_info = None - self.code = None - self.details = None - self.message = None - self.target = None - - -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. - - :ivar info: The additional info. - :vartype info: JSON - :ivar type: The additional info type. - :vartype type: str - """ - - _validation = { - "info": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "info": {"key": "info", "type": "object"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.info = None - self.type = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.dataprotection.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.dataprotection.models.ErrorAdditionalInfo] - """ - - _validation = { - "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": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.dataprotection.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.dataprotection.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class ExportJobsResult(_serialization.Model): - """The result for export jobs containing blob details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar blob_url: URL of the blob into which the serialized string of list of jobs is exported. - :vartype blob_url: str - :ivar blob_sas_key: SAS key to access the blob. - :vartype blob_sas_key: str - :ivar excel_file_blob_url: URL of the blob into which the ExcelFile is uploaded. - :vartype excel_file_blob_url: str - :ivar excel_file_blob_sas_key: SAS key to access the ExcelFile blob. - :vartype excel_file_blob_sas_key: str - """ - - _validation = { - "blob_url": {"readonly": True}, - "blob_sas_key": {"readonly": True}, - "excel_file_blob_url": {"readonly": True}, - "excel_file_blob_sas_key": {"readonly": True}, - } - - _attribute_map = { - "blob_url": {"key": "blobUrl", "type": "str"}, - "blob_sas_key": {"key": "blobSasKey", "type": "str"}, - "excel_file_blob_url": {"key": "excelFileBlobUrl", "type": "str"}, - "excel_file_blob_sas_key": {"key": "excelFileBlobSasKey", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.blob_url = None - self.blob_sas_key = None - self.excel_file_blob_url = None - self.excel_file_blob_sas_key = None - - -class FeatureSettings(_serialization.Model): - """Class containing feature settings of vault. - - :ivar cross_subscription_restore_settings: CrossSubscriptionRestore Settings. - :vartype cross_subscription_restore_settings: - ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings - :ivar cross_region_restore_settings: - :vartype cross_region_restore_settings: - ~azure.mgmt.dataprotection.models.CrossRegionRestoreSettings - """ - - _attribute_map = { - "cross_subscription_restore_settings": { - "key": "crossSubscriptionRestoreSettings", - "type": "CrossSubscriptionRestoreSettings", - }, - "cross_region_restore_settings": {"key": "crossRegionRestoreSettings", "type": "CrossRegionRestoreSettings"}, - } - - def __init__( - self, - *, - cross_subscription_restore_settings: Optional["_models.CrossSubscriptionRestoreSettings"] = None, - cross_region_restore_settings: Optional["_models.CrossRegionRestoreSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword cross_subscription_restore_settings: CrossSubscriptionRestore Settings. - :paramtype cross_subscription_restore_settings: - ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings - :keyword cross_region_restore_settings: - :paramtype cross_region_restore_settings: - ~azure.mgmt.dataprotection.models.CrossRegionRestoreSettings - """ - super().__init__(**kwargs) - self.cross_subscription_restore_settings = cross_subscription_restore_settings - self.cross_region_restore_settings = cross_region_restore_settings - - -class FeatureValidationRequestBase(_serialization.Model): - """Base class for Backup Feature support. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - FeatureValidationRequest - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"FeatureValidationRequest": "FeatureValidationRequest"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class FeatureValidationRequest(FeatureValidationRequestBase): - """Base class for feature object. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar feature_type: backup support feature type. Known values are: "Invalid" and - "DataSourceType". - :vartype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :ivar feature_name: backup support feature name. - :vartype feature_name: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "feature_type": {"key": "featureType", "type": "str"}, - "feature_name": {"key": "featureName", "type": "str"}, - } - - def __init__( - self, - *, - feature_type: Optional[Union[str, "_models.FeatureType"]] = None, - feature_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword feature_type: backup support feature type. Known values are: "Invalid" and - "DataSourceType". - :paramtype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :keyword feature_name: backup support feature name. - :paramtype feature_name: str - """ - super().__init__(**kwargs) - self.object_type: str = "FeatureValidationRequest" - self.feature_type = feature_type - self.feature_name = feature_name - - -class FeatureValidationResponseBase(_serialization.Model): - """Base class for Backup Feature support. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - FeatureValidationResponse - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"FeatureValidationResponse": "FeatureValidationResponse"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class FeatureValidationResponse(FeatureValidationResponseBase): - """Feature Validation Response. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar feature_type: backup support feature type. Known values are: "Invalid" and - "DataSourceType". - :vartype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :ivar features: Response features. - :vartype features: list[~azure.mgmt.dataprotection.models.SupportedFeature] - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "feature_type": {"key": "featureType", "type": "str"}, - "features": {"key": "features", "type": "[SupportedFeature]"}, - } - - def __init__( - self, - *, - feature_type: Optional[Union[str, "_models.FeatureType"]] = None, - features: Optional[List["_models.SupportedFeature"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword feature_type: backup support feature type. Known values are: "Invalid" and - "DataSourceType". - :paramtype feature_type: str or ~azure.mgmt.dataprotection.models.FeatureType - :keyword features: Response features. - :paramtype features: list[~azure.mgmt.dataprotection.models.SupportedFeature] - """ - super().__init__(**kwargs) - self.object_type: str = "FeatureValidationResponse" - self.feature_type = feature_type - self.features = features - - -class FetchSecondaryRPsRequestParameters(_serialization.Model): - """Information about BI whose secondary RecoveryPoints are requested - Source region and - BI ARM path. - - :ivar source_region: Source region in which BackupInstance is located. - :vartype source_region: str - :ivar source_backup_instance_id: ARM Path of BackupInstance. - :vartype source_backup_instance_id: str - """ - - _attribute_map = { - "source_region": {"key": "sourceRegion", "type": "str"}, - "source_backup_instance_id": {"key": "sourceBackupInstanceId", "type": "str"}, - } - - def __init__( - self, *, source_region: Optional[str] = None, source_backup_instance_id: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword source_region: Source region in which BackupInstance is located. - :paramtype source_region: str - :keyword source_backup_instance_id: ARM Path of BackupInstance. - :paramtype source_backup_instance_id: str - """ - super().__init__(**kwargs) - self.source_region = source_region - self.source_backup_instance_id = source_backup_instance_id - - -class IdentityDetails(_serialization.Model): - """IdentityDetails. - - :ivar use_system_assigned_identity: Specifies if the BI is protected by System Identity. - :vartype use_system_assigned_identity: bool - :ivar user_assigned_identity_arm_url: ARM URL for User Assigned Identity. - :vartype user_assigned_identity_arm_url: str - """ - - _attribute_map = { - "use_system_assigned_identity": {"key": "useSystemAssignedIdentity", "type": "bool"}, - "user_assigned_identity_arm_url": {"key": "userAssignedIdentityArmUrl", "type": "str"}, - } - - def __init__( - self, - *, - use_system_assigned_identity: Optional[bool] = None, - user_assigned_identity_arm_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword use_system_assigned_identity: Specifies if the BI is protected by System Identity. - :paramtype use_system_assigned_identity: bool - :keyword user_assigned_identity_arm_url: ARM URL for User Assigned Identity. - :paramtype user_assigned_identity_arm_url: str - """ - super().__init__(**kwargs) - self.use_system_assigned_identity = use_system_assigned_identity - self.user_assigned_identity_arm_url = user_assigned_identity_arm_url - - -class ImmediateCopyOption(CopyOption): - """Immediate copy Option. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: str = "ImmediateCopyOption" - - -class ImmutabilitySettings(_serialization.Model): - """Immutability Settings at vault level. - - :ivar state: Immutability state. Known values are: "Disabled", "Unlocked", and "Locked". - :vartype state: str or ~azure.mgmt.dataprotection.models.ImmutabilityState - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - } - - def __init__(self, *, state: Optional[Union[str, "_models.ImmutabilityState"]] = None, **kwargs: Any) -> None: - """ - :keyword state: Immutability state. Known values are: "Disabled", "Unlocked", and "Locked". - :paramtype state: str or ~azure.mgmt.dataprotection.models.ImmutabilityState - """ - super().__init__(**kwargs) - self.state = state - - -class InnerError(_serialization.Model): - """Inner Error. - - :ivar additional_info: Any Key value pairs that can be provided to the client for additional - verbose information. - :vartype additional_info: dict[str, str] - :ivar code: Unique code for this error. - :vartype code: str - :ivar embedded_inner_error: Child Inner Error, to allow Nesting. - :vartype embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError - """ - - _attribute_map = { - "additional_info": {"key": "additionalInfo", "type": "{str}"}, - "code": {"key": "code", "type": "str"}, - "embedded_inner_error": {"key": "embeddedInnerError", "type": "InnerError"}, - } - - def __init__( - self, - *, - additional_info: Optional[Dict[str, str]] = None, - code: Optional[str] = None, - embedded_inner_error: Optional["_models.InnerError"] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_info: Any Key value pairs that can be provided to the client for additional - verbose information. - :paramtype additional_info: dict[str, str] - :keyword code: Unique code for this error. - :paramtype code: str - :keyword embedded_inner_error: Child Inner Error, to allow Nesting. - :paramtype embedded_inner_error: ~azure.mgmt.dataprotection.models.InnerError - """ - super().__init__(**kwargs) - self.additional_info = additional_info - self.code = code - self.embedded_inner_error = embedded_inner_error - - -class ItemLevelRestoreCriteria(_serialization.Model): - """Class to contain criteria for item level restore. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ItemPathBasedRestoreCriteria, KubernetesClusterRestoreCriteria, - KubernetesClusterVaultTierRestoreCriteria, KubernetesPVRestoreCriteria, - KubernetesStorageClassRestoreCriteria, RangeBasedItemLevelRestoreCriteria - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = { - "object_type": { - "ItemPathBasedRestoreCriteria": "ItemPathBasedRestoreCriteria", - "KubernetesClusterRestoreCriteria": "KubernetesClusterRestoreCriteria", - "KubernetesClusterVaultTierRestoreCriteria": "KubernetesClusterVaultTierRestoreCriteria", - "KubernetesPVRestoreCriteria": "KubernetesPVRestoreCriteria", - "KubernetesStorageClassRestoreCriteria": "KubernetesStorageClassRestoreCriteria", - "RangeBasedItemLevelRestoreCriteria": "RangeBasedItemLevelRestoreCriteria", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class RestoreTargetInfoBase(_serialization.Model): - """Base class common to RestoreTargetInfo and RestoreFilesTargetInfo. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ItemLevelRestoreTargetInfo, RestoreFilesTargetInfo, RestoreTargetInfo - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - Required. - :vartype object_type: str - :ivar recovery_option: Recovery Option. Required. "FailIfExists" - :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :ivar restore_location: Target Restore region. - :vartype restore_location: str - """ - - _validation = { - "object_type": {"required": True}, - "recovery_option": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "recovery_option": {"key": "recoveryOption", "type": "str"}, - "restore_location": {"key": "restoreLocation", "type": "str"}, - } - - _subtype_map = { - "object_type": { - "ItemLevelRestoreTargetInfo": "ItemLevelRestoreTargetInfo", - "RestoreFilesTargetInfo": "RestoreFilesTargetInfo", - "RestoreTargetInfo": "RestoreTargetInfo", - } - } - - def __init__( - self, - *, - recovery_option: Union[str, "_models.RecoveryOption"], - restore_location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_option: Recovery Option. Required. "FailIfExists" - :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :keyword restore_location: Target Restore region. - :paramtype restore_location: str - """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - self.recovery_option = recovery_option - self.restore_location = restore_location - - -class ItemLevelRestoreTargetInfo(RestoreTargetInfoBase): - """Restore target info for Item level restore operation. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - Required. - :vartype object_type: str - :ivar recovery_option: Recovery Option. Required. "FailIfExists" - :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :ivar restore_location: Target Restore region. - :vartype restore_location: str - :ivar restore_criteria: Restore Criteria. Required. - :vartype restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] - :ivar datasource_info: Information of target DS. Required. - :vartype datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :ivar datasource_set_info: Information of target DS Set. - :vartype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :ivar datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - """ - - _validation = { - "object_type": {"required": True}, - "recovery_option": {"required": True}, - "restore_criteria": {"required": True}, - "datasource_info": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "recovery_option": {"key": "recoveryOption", "type": "str"}, - "restore_location": {"key": "restoreLocation", "type": "str"}, - "restore_criteria": {"key": "restoreCriteria", "type": "[ItemLevelRestoreCriteria]"}, - "datasource_info": {"key": "datasourceInfo", "type": "Datasource"}, - "datasource_set_info": {"key": "datasourceSetInfo", "type": "DatasourceSet"}, - "datasource_auth_credentials": {"key": "datasourceAuthCredentials", "type": "AuthCredentials"}, - } - - def __init__( - self, - *, - recovery_option: Union[str, "_models.RecoveryOption"], - restore_criteria: List["_models.ItemLevelRestoreCriteria"], - datasource_info: "_models.Datasource", - restore_location: Optional[str] = None, - datasource_set_info: Optional["_models.DatasourceSet"] = None, - datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_option: Recovery Option. Required. "FailIfExists" - :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :keyword restore_location: Target Restore region. - :paramtype restore_location: str - :keyword restore_criteria: Restore Criteria. Required. - :paramtype restore_criteria: list[~azure.mgmt.dataprotection.models.ItemLevelRestoreCriteria] - :keyword datasource_info: Information of target DS. Required. - :paramtype datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :keyword datasource_set_info: Information of target DS Set. - :paramtype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :keyword datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - """ - super().__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) - self.object_type: str = "ItemLevelRestoreTargetInfo" - self.restore_criteria = restore_criteria - self.datasource_info = datasource_info - self.datasource_set_info = datasource_set_info - self.datasource_auth_credentials = datasource_auth_credentials - - -class ItemPathBasedRestoreCriteria(ItemLevelRestoreCriteria): - """Prefix criteria to be used to during restore. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar item_path: The path of the item to be restored. It could be the full path of the item or - the path relative to the backup item. Required. - :vartype item_path: str - :ivar is_path_relative_to_backup_item: Flag to specify if the path is relative to backup item - or full path. Required. - :vartype is_path_relative_to_backup_item: bool - :ivar sub_item_path_prefix: The list of prefix strings to be used as filter criteria during - restore. These are relative to the item path specified. - :vartype sub_item_path_prefix: list[str] - """ - - _validation = { - "object_type": {"required": True}, - "item_path": {"required": True}, - "is_path_relative_to_backup_item": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "item_path": {"key": "itemPath", "type": "str"}, - "is_path_relative_to_backup_item": {"key": "isPathRelativeToBackupItem", "type": "bool"}, - "sub_item_path_prefix": {"key": "subItemPathPrefix", "type": "[str]"}, - } - - def __init__( - self, - *, - item_path: str, - is_path_relative_to_backup_item: bool, - sub_item_path_prefix: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword item_path: The path of the item to be restored. It could be the full path of the item - or the path relative to the backup item. Required. - :paramtype item_path: str - :keyword is_path_relative_to_backup_item: Flag to specify if the path is relative to backup - item or full path. Required. - :paramtype is_path_relative_to_backup_item: bool - :keyword sub_item_path_prefix: The list of prefix strings to be used as filter criteria during - restore. These are relative to the item path specified. - :paramtype sub_item_path_prefix: list[str] - """ - super().__init__(**kwargs) - self.object_type: str = "ItemPathBasedRestoreCriteria" - self.item_path = item_path - self.is_path_relative_to_backup_item = is_path_relative_to_backup_item - self.sub_item_path_prefix = sub_item_path_prefix - - -class JobExtendedInfo(_serialization.Model): - """Extended Information about the job. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_details: Job's Additional Details. - :vartype additional_details: dict[str, str] - :ivar backup_instance_state: State of the Backup Instance. - :vartype backup_instance_state: str - :ivar data_transferred_in_bytes: Number of bytes transferred. - :vartype data_transferred_in_bytes: float - :ivar recovery_destination: Destination where restore is done. - :vartype recovery_destination: str - :ivar source_recover_point: Details of the Source Recovery Point. - :vartype source_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails - :ivar sub_tasks: List of Sub Tasks of the job. - :vartype sub_tasks: list[~azure.mgmt.dataprotection.models.JobSubTask] - :ivar target_recover_point: Details of the Target Recovery Point. - :vartype target_recover_point: ~azure.mgmt.dataprotection.models.RestoreJobRecoveryPointDetails - :ivar warning_details: A List, detailing the warnings related to the job. - :vartype warning_details: list[~azure.mgmt.dataprotection.models.UserFacingWarningDetail] - """ - - _validation = { - "backup_instance_state": {"readonly": True}, - "data_transferred_in_bytes": {"readonly": True}, - "recovery_destination": {"readonly": True}, - "source_recover_point": {"readonly": True}, - "sub_tasks": {"readonly": True}, - "target_recover_point": {"readonly": True}, - "warning_details": {"readonly": True}, - } - - _attribute_map = { - "additional_details": {"key": "additionalDetails", "type": "{str}"}, - "backup_instance_state": {"key": "backupInstanceState", "type": "str"}, - "data_transferred_in_bytes": {"key": "dataTransferredInBytes", "type": "float"}, - "recovery_destination": {"key": "recoveryDestination", "type": "str"}, - "source_recover_point": {"key": "sourceRecoverPoint", "type": "RestoreJobRecoveryPointDetails"}, - "sub_tasks": {"key": "subTasks", "type": "[JobSubTask]"}, - "target_recover_point": {"key": "targetRecoverPoint", "type": "RestoreJobRecoveryPointDetails"}, - "warning_details": {"key": "warningDetails", "type": "[UserFacingWarningDetail]"}, - } - - def __init__(self, *, additional_details: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword additional_details: Job's Additional Details. - :paramtype additional_details: dict[str, str] - """ - super().__init__(**kwargs) - self.additional_details = additional_details - self.backup_instance_state = None - self.data_transferred_in_bytes = None - self.recovery_destination = None - self.source_recover_point = None - self.sub_tasks = None - self.target_recover_point = None - self.warning_details = None - - -class JobSubTask(_serialization.Model): - """Details of Job's Sub Task. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar additional_details: Additional details of Sub Tasks. - :vartype additional_details: dict[str, str] - :ivar task_id: Task Id of the Sub Task. Required. - :vartype task_id: int - :ivar task_name: Name of the Sub Task. Required. - :vartype task_name: str - :ivar task_progress: Progress of the Sub Task. - :vartype task_progress: str - :ivar task_status: Status of the Sub Task. Required. - :vartype task_status: str - """ - - _validation = { - "task_id": {"required": True}, - "task_name": {"required": True}, - "task_progress": {"readonly": True}, - "task_status": {"required": True}, - } - - _attribute_map = { - "additional_details": {"key": "additionalDetails", "type": "{str}"}, - "task_id": {"key": "taskId", "type": "int"}, - "task_name": {"key": "taskName", "type": "str"}, - "task_progress": {"key": "taskProgress", "type": "str"}, - "task_status": {"key": "taskStatus", "type": "str"}, - } - - def __init__( - self, - *, - task_id: int, - task_name: str, - task_status: str, - additional_details: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_details: Additional details of Sub Tasks. - :paramtype additional_details: dict[str, str] - :keyword task_id: Task Id of the Sub Task. Required. - :paramtype task_id: int - :keyword task_name: Name of the Sub Task. Required. - :paramtype task_name: str - :keyword task_status: Status of the Sub Task. Required. - :paramtype task_status: str - """ - super().__init__(**kwargs) - self.additional_details = additional_details - self.task_id = task_id - self.task_name = task_name - self.task_progress = None - self.task_status = task_status - - -class KubernetesClusterBackupDatasourceParameters(BackupDatasourceParameters): # pylint: disable=name-too-long - """Parameters for Kubernetes Cluster Backup Datasource. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled - will take volume snapshots during backup. Required. - :vartype snapshot_volumes: bool - :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during backup. Required. - :vartype include_cluster_scope_resources: bool - :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the - namespaces to be included during backup. - :vartype included_namespaces: list[str] - :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the - namespaces to be excluded during backup. - :vartype excluded_namespaces: list[str] - :ivar included_resource_types: Gets or sets the include resource types property. This property - sets the resource types to be included during backup. - :vartype included_resource_types: list[str] - :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property - sets the resource types to be excluded during backup. - :vartype excluded_resource_types: list[str] - :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during backup. - :vartype label_selectors: list[str] - :ivar backup_hook_references: Gets or sets the backup hook references. This property sets the - hook reference to be executed during backup. - :vartype backup_hook_references: list[~azure.mgmt.dataprotection.models.NamespacedNameResource] - """ - - _validation = { - "object_type": {"required": True}, - "snapshot_volumes": {"required": True}, - "include_cluster_scope_resources": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "snapshot_volumes": {"key": "snapshotVolumes", "type": "bool"}, - "include_cluster_scope_resources": {"key": "includeClusterScopeResources", "type": "bool"}, - "included_namespaces": {"key": "includedNamespaces", "type": "[str]"}, - "excluded_namespaces": {"key": "excludedNamespaces", "type": "[str]"}, - "included_resource_types": {"key": "includedResourceTypes", "type": "[str]"}, - "excluded_resource_types": {"key": "excludedResourceTypes", "type": "[str]"}, - "label_selectors": {"key": "labelSelectors", "type": "[str]"}, - "backup_hook_references": {"key": "backupHookReferences", "type": "[NamespacedNameResource]"}, - } - - def __init__( - self, - *, - snapshot_volumes: bool, - include_cluster_scope_resources: bool, - included_namespaces: Optional[List[str]] = None, - excluded_namespaces: Optional[List[str]] = None, - included_resource_types: Optional[List[str]] = None, - excluded_resource_types: Optional[List[str]] = None, - label_selectors: Optional[List[str]] = None, - backup_hook_references: Optional[List["_models.NamespacedNameResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword snapshot_volumes: Gets or sets the volume snapshot property. This property if enabled - will take volume snapshots during backup. Required. - :paramtype snapshot_volumes: bool - :keyword include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during backup. Required. - :paramtype include_cluster_scope_resources: bool - :keyword included_namespaces: Gets or sets the include namespaces property. This property sets - the namespaces to be included during backup. - :paramtype included_namespaces: list[str] - :keyword excluded_namespaces: Gets or sets the exclude namespaces property. This property sets - the namespaces to be excluded during backup. - :paramtype excluded_namespaces: list[str] - :keyword included_resource_types: Gets or sets the include resource types property. This - property sets the resource types to be included during backup. - :paramtype included_resource_types: list[str] - :keyword excluded_resource_types: Gets or sets the exclude resource types property. This - property sets the resource types to be excluded during backup. - :paramtype excluded_resource_types: list[str] - :keyword label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during backup. - :paramtype label_selectors: list[str] - :keyword backup_hook_references: Gets or sets the backup hook references. This property sets - the hook reference to be executed during backup. - :paramtype backup_hook_references: - list[~azure.mgmt.dataprotection.models.NamespacedNameResource] - """ - super().__init__(**kwargs) - self.object_type: str = "KubernetesClusterBackupDatasourceParameters" - self.snapshot_volumes = snapshot_volumes - self.include_cluster_scope_resources = include_cluster_scope_resources - self.included_namespaces = included_namespaces - self.excluded_namespaces = excluded_namespaces - self.included_resource_types = included_resource_types - self.excluded_resource_types = excluded_resource_types - self.label_selectors = label_selectors - self.backup_hook_references = backup_hook_references - - -class KubernetesClusterRestoreCriteria(ItemLevelRestoreCriteria): # pylint: disable=too-many-instance-attributes - """kubernetes Cluster Backup target info for restore operation. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during restore. Required. - :vartype include_cluster_scope_resources: bool - :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the - namespaces to be included during restore. - :vartype included_namespaces: list[str] - :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the - namespaces to be excluded during restore. - :vartype excluded_namespaces: list[str] - :ivar included_resource_types: Gets or sets the include resource types property. This property - sets the resource types to be included during restore. - :vartype included_resource_types: list[str] - :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property - sets the resource types to be excluded during restore. - :vartype excluded_resource_types: list[str] - :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during restore. - :vartype label_selectors: list[str] - :ivar persistent_volume_restore_mode: Gets or sets the PV (Persistent Volume) Restore Mode - property. This property sets whether volumes needs to be restored. Known values are: - "RestoreWithVolumeData" and "RestoreWithoutVolumeData". - :vartype persistent_volume_restore_mode: str or - ~azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode - :ivar conflict_policy: Gets or sets the Conflict Policy property. This property sets policy - during conflict of resources during restore. Known values are: "Skip" and "Patch". - :vartype conflict_policy: str or ~azure.mgmt.dataprotection.models.ExistingResourcePolicy - :ivar namespace_mappings: Gets or sets the Namespace Mappings property. This property sets if - namespace needs to be change during restore. - :vartype namespace_mappings: dict[str, str] - :ivar restore_hook_references: Gets or sets the restore hook references. This property sets the - hook reference to be executed during restore. - :vartype restore_hook_references: - list[~azure.mgmt.dataprotection.models.NamespacedNameResource] - :ivar resource_modifier_reference: Gets or sets the resource modifier reference. This property - sets the reference for resource modifier during restore. - :vartype resource_modifier_reference: ~azure.mgmt.dataprotection.models.NamespacedNameResource - """ - - _validation = { - "object_type": {"required": True}, - "include_cluster_scope_resources": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "include_cluster_scope_resources": {"key": "includeClusterScopeResources", "type": "bool"}, - "included_namespaces": {"key": "includedNamespaces", "type": "[str]"}, - "excluded_namespaces": {"key": "excludedNamespaces", "type": "[str]"}, - "included_resource_types": {"key": "includedResourceTypes", "type": "[str]"}, - "excluded_resource_types": {"key": "excludedResourceTypes", "type": "[str]"}, - "label_selectors": {"key": "labelSelectors", "type": "[str]"}, - "persistent_volume_restore_mode": {"key": "persistentVolumeRestoreMode", "type": "str"}, - "conflict_policy": {"key": "conflictPolicy", "type": "str"}, - "namespace_mappings": {"key": "namespaceMappings", "type": "{str}"}, - "restore_hook_references": {"key": "restoreHookReferences", "type": "[NamespacedNameResource]"}, - "resource_modifier_reference": {"key": "resourceModifierReference", "type": "NamespacedNameResource"}, - } - - def __init__( - self, - *, - include_cluster_scope_resources: bool, - included_namespaces: Optional[List[str]] = None, - excluded_namespaces: Optional[List[str]] = None, - included_resource_types: Optional[List[str]] = None, - excluded_resource_types: Optional[List[str]] = None, - label_selectors: Optional[List[str]] = None, - persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = None, - conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = None, - namespace_mappings: Optional[Dict[str, str]] = None, - restore_hook_references: Optional[List["_models.NamespacedNameResource"]] = None, - resource_modifier_reference: Optional["_models.NamespacedNameResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during restore. Required. - :paramtype include_cluster_scope_resources: bool - :keyword included_namespaces: Gets or sets the include namespaces property. This property sets - the namespaces to be included during restore. - :paramtype included_namespaces: list[str] - :keyword excluded_namespaces: Gets or sets the exclude namespaces property. This property sets - the namespaces to be excluded during restore. - :paramtype excluded_namespaces: list[str] - :keyword included_resource_types: Gets or sets the include resource types property. This - property sets the resource types to be included during restore. - :paramtype included_resource_types: list[str] - :keyword excluded_resource_types: Gets or sets the exclude resource types property. This - property sets the resource types to be excluded during restore. - :paramtype excluded_resource_types: list[str] - :keyword label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during restore. - :paramtype label_selectors: list[str] - :keyword persistent_volume_restore_mode: Gets or sets the PV (Persistent Volume) Restore Mode - property. This property sets whether volumes needs to be restored. Known values are: - "RestoreWithVolumeData" and "RestoreWithoutVolumeData". - :paramtype persistent_volume_restore_mode: str or - ~azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode - :keyword conflict_policy: Gets or sets the Conflict Policy property. This property sets policy - during conflict of resources during restore. Known values are: "Skip" and "Patch". - :paramtype conflict_policy: str or ~azure.mgmt.dataprotection.models.ExistingResourcePolicy - :keyword namespace_mappings: Gets or sets the Namespace Mappings property. This property sets - if namespace needs to be change during restore. - :paramtype namespace_mappings: dict[str, str] - :keyword restore_hook_references: Gets or sets the restore hook references. This property sets - the hook reference to be executed during restore. - :paramtype restore_hook_references: - list[~azure.mgmt.dataprotection.models.NamespacedNameResource] - :keyword resource_modifier_reference: Gets or sets the resource modifier reference. This - property sets the reference for resource modifier during restore. - :paramtype resource_modifier_reference: - ~azure.mgmt.dataprotection.models.NamespacedNameResource - """ - super().__init__(**kwargs) - self.object_type: str = "KubernetesClusterRestoreCriteria" - self.include_cluster_scope_resources = include_cluster_scope_resources - self.included_namespaces = included_namespaces - self.excluded_namespaces = excluded_namespaces - self.included_resource_types = included_resource_types - self.excluded_resource_types = excluded_resource_types - self.label_selectors = label_selectors - self.persistent_volume_restore_mode = persistent_volume_restore_mode - self.conflict_policy = conflict_policy - self.namespace_mappings = namespace_mappings - self.restore_hook_references = restore_hook_references - self.resource_modifier_reference = resource_modifier_reference - - -class KubernetesClusterVaultTierRestoreCriteria( - ItemLevelRestoreCriteria -): # pylint: disable=too-many-instance-attributes,name-too-long - """kubernetes Cluster Backup target info for restore operation from vault. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during restore from vault. - Required. - :vartype include_cluster_scope_resources: bool - :ivar included_namespaces: Gets or sets the include namespaces property. This property sets the - namespaces to be included during restore from vault. - :vartype included_namespaces: list[str] - :ivar excluded_namespaces: Gets or sets the exclude namespaces property. This property sets the - namespaces to be excluded during restore from vault. - :vartype excluded_namespaces: list[str] - :ivar included_resource_types: Gets or sets the include resource types property. This property - sets the resource types to be included during restore from vault. - :vartype included_resource_types: list[str] - :ivar excluded_resource_types: Gets or sets the exclude resource types property. This property - sets the resource types to be excluded during restore from vault. - :vartype excluded_resource_types: list[str] - :ivar label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during restore from vault. - :vartype label_selectors: list[str] - :ivar persistent_volume_restore_mode: Gets or sets the PV (Persistent Volume) Restore Mode - property. This property sets whether volumes needs to be restored from vault. Known values are: - "RestoreWithVolumeData" and "RestoreWithoutVolumeData". - :vartype persistent_volume_restore_mode: str or - ~azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode - :ivar conflict_policy: Gets or sets the Conflict Policy property. This property sets policy - during conflict of resources during restore from vault. Known values are: "Skip" and "Patch". - :vartype conflict_policy: str or ~azure.mgmt.dataprotection.models.ExistingResourcePolicy - :ivar namespace_mappings: Gets or sets the Namespace Mappings property. This property sets if - namespace needs to be change during restore from vault. - :vartype namespace_mappings: dict[str, str] - :ivar restore_hook_references: Gets or sets the restore hook references. This property sets the - hook reference to be executed during restore from vault. - :vartype restore_hook_references: - list[~azure.mgmt.dataprotection.models.NamespacedNameResource] - :ivar staging_resource_group_id: Gets or sets the staging RG Id for creating staging disks and - snapshots during restore from vault. - :vartype staging_resource_group_id: str - :ivar staging_storage_account_id: Gets or sets the staging Storage Account Id for creating - backup extension object store data during restore from vault. - :vartype staging_storage_account_id: str - :ivar resource_modifier_reference: Gets or sets the resource modifier reference. This property - sets the reference for resource modifier during restore. - :vartype resource_modifier_reference: ~azure.mgmt.dataprotection.models.NamespacedNameResource - """ - - _validation = { - "object_type": {"required": True}, - "include_cluster_scope_resources": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "include_cluster_scope_resources": {"key": "includeClusterScopeResources", "type": "bool"}, - "included_namespaces": {"key": "includedNamespaces", "type": "[str]"}, - "excluded_namespaces": {"key": "excludedNamespaces", "type": "[str]"}, - "included_resource_types": {"key": "includedResourceTypes", "type": "[str]"}, - "excluded_resource_types": {"key": "excludedResourceTypes", "type": "[str]"}, - "label_selectors": {"key": "labelSelectors", "type": "[str]"}, - "persistent_volume_restore_mode": {"key": "persistentVolumeRestoreMode", "type": "str"}, - "conflict_policy": {"key": "conflictPolicy", "type": "str"}, - "namespace_mappings": {"key": "namespaceMappings", "type": "{str}"}, - "restore_hook_references": {"key": "restoreHookReferences", "type": "[NamespacedNameResource]"}, - "staging_resource_group_id": {"key": "stagingResourceGroupId", "type": "str"}, - "staging_storage_account_id": {"key": "stagingStorageAccountId", "type": "str"}, - "resource_modifier_reference": {"key": "resourceModifierReference", "type": "NamespacedNameResource"}, - } - - def __init__( - self, - *, - include_cluster_scope_resources: bool, - included_namespaces: Optional[List[str]] = None, - excluded_namespaces: Optional[List[str]] = None, - included_resource_types: Optional[List[str]] = None, - excluded_resource_types: Optional[List[str]] = None, - label_selectors: Optional[List[str]] = None, - persistent_volume_restore_mode: Optional[Union[str, "_models.PersistentVolumeRestoreMode"]] = None, - conflict_policy: Optional[Union[str, "_models.ExistingResourcePolicy"]] = None, - namespace_mappings: Optional[Dict[str, str]] = None, - restore_hook_references: Optional[List["_models.NamespacedNameResource"]] = None, - staging_resource_group_id: Optional[str] = None, - staging_storage_account_id: Optional[str] = None, - resource_modifier_reference: Optional["_models.NamespacedNameResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword include_cluster_scope_resources: Gets or sets the include cluster resources property. - This property if enabled will include cluster scope resources during restore from vault. - Required. - :paramtype include_cluster_scope_resources: bool - :keyword included_namespaces: Gets or sets the include namespaces property. This property sets - the namespaces to be included during restore from vault. - :paramtype included_namespaces: list[str] - :keyword excluded_namespaces: Gets or sets the exclude namespaces property. This property sets - the namespaces to be excluded during restore from vault. - :paramtype excluded_namespaces: list[str] - :keyword included_resource_types: Gets or sets the include resource types property. This - property sets the resource types to be included during restore from vault. - :paramtype included_resource_types: list[str] - :keyword excluded_resource_types: Gets or sets the exclude resource types property. This - property sets the resource types to be excluded during restore from vault. - :paramtype excluded_resource_types: list[str] - :keyword label_selectors: Gets or sets the LabelSelectors property. This property sets the - resource with such label selectors to be included during restore from vault. - :paramtype label_selectors: list[str] - :keyword persistent_volume_restore_mode: Gets or sets the PV (Persistent Volume) Restore Mode - property. This property sets whether volumes needs to be restored from vault. Known values are: - "RestoreWithVolumeData" and "RestoreWithoutVolumeData". - :paramtype persistent_volume_restore_mode: str or - ~azure.mgmt.dataprotection.models.PersistentVolumeRestoreMode - :keyword conflict_policy: Gets or sets the Conflict Policy property. This property sets policy - during conflict of resources during restore from vault. Known values are: "Skip" and "Patch". - :paramtype conflict_policy: str or ~azure.mgmt.dataprotection.models.ExistingResourcePolicy - :keyword namespace_mappings: Gets or sets the Namespace Mappings property. This property sets - if namespace needs to be change during restore from vault. - :paramtype namespace_mappings: dict[str, str] - :keyword restore_hook_references: Gets or sets the restore hook references. This property sets - the hook reference to be executed during restore from vault. - :paramtype restore_hook_references: - list[~azure.mgmt.dataprotection.models.NamespacedNameResource] - :keyword staging_resource_group_id: Gets or sets the staging RG Id for creating staging disks - and snapshots during restore from vault. - :paramtype staging_resource_group_id: str - :keyword staging_storage_account_id: Gets or sets the staging Storage Account Id for creating - backup extension object store data during restore from vault. - :paramtype staging_storage_account_id: str - :keyword resource_modifier_reference: Gets or sets the resource modifier reference. This - property sets the reference for resource modifier during restore. - :paramtype resource_modifier_reference: - ~azure.mgmt.dataprotection.models.NamespacedNameResource - """ - super().__init__(**kwargs) - self.object_type: str = "KubernetesClusterVaultTierRestoreCriteria" - self.include_cluster_scope_resources = include_cluster_scope_resources - self.included_namespaces = included_namespaces - self.excluded_namespaces = excluded_namespaces - self.included_resource_types = included_resource_types - self.excluded_resource_types = excluded_resource_types - self.label_selectors = label_selectors - self.persistent_volume_restore_mode = persistent_volume_restore_mode - self.conflict_policy = conflict_policy - self.namespace_mappings = namespace_mappings - self.restore_hook_references = restore_hook_references - self.staging_resource_group_id = staging_resource_group_id - self.staging_storage_account_id = staging_storage_account_id - self.resource_modifier_reference = resource_modifier_reference - - -class KubernetesPVRestoreCriteria(ItemLevelRestoreCriteria): - """Item Level kubernetes persistent volume target info for restore operation. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar name: Selected persistent volume claim name. - :vartype name: str - :ivar storage_class_name: Selected storage class name for restore operation. - :vartype storage_class_name: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "storage_class_name": {"key": "storageClassName", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, storage_class_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Selected persistent volume claim name. - :paramtype name: str - :keyword storage_class_name: Selected storage class name for restore operation. - :paramtype storage_class_name: str - """ - super().__init__(**kwargs) - self.object_type: str = "KubernetesPVRestoreCriteria" - self.name = name - self.storage_class_name = storage_class_name - - -class KubernetesStorageClassRestoreCriteria(ItemLevelRestoreCriteria): - """Item Level kubernetes storage class target info for restore operation. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar selected_storage_class_name: Selected storage class name. - :vartype selected_storage_class_name: str - :ivar provisioner: Provisioner of the storage class. - :vartype provisioner: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "selected_storage_class_name": {"key": "selectedStorageClassName", "type": "str"}, - "provisioner": {"key": "provisioner", "type": "str"}, - } - - def __init__( - self, *, selected_storage_class_name: Optional[str] = None, provisioner: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword selected_storage_class_name: Selected storage class name. - :paramtype selected_storage_class_name: str - :keyword provisioner: Provisioner of the storage class. - :paramtype provisioner: str - """ - super().__init__(**kwargs) - self.object_type: str = "KubernetesStorageClassRestoreCriteria" - self.selected_storage_class_name = selected_storage_class_name - self.provisioner = provisioner - - -class MonitoringSettings(_serialization.Model): - """Monitoring Settings. - - :ivar azure_monitor_alert_settings: Settings for Azure Monitor based alerts. - :vartype azure_monitor_alert_settings: - ~azure.mgmt.dataprotection.models.AzureMonitorAlertSettings - """ - - _attribute_map = { - "azure_monitor_alert_settings": {"key": "azureMonitorAlertSettings", "type": "AzureMonitorAlertSettings"}, - } - - def __init__( - self, *, azure_monitor_alert_settings: Optional["_models.AzureMonitorAlertSettings"] = None, **kwargs: Any - ) -> None: - """ - :keyword azure_monitor_alert_settings: Settings for Azure Monitor based alerts. - :paramtype azure_monitor_alert_settings: - ~azure.mgmt.dataprotection.models.AzureMonitorAlertSettings - """ - super().__init__(**kwargs) - self.azure_monitor_alert_settings = azure_monitor_alert_settings - - -class NamespacedNameResource(_serialization.Model): - """Class to refer resources which contains namespace and name. - - :ivar name: Name of the resource. - :vartype name: str - :ivar namespace: Namespace in which the resource exists. - :vartype namespace: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "namespace": {"key": "namespace", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, namespace: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Name of the resource. - :paramtype name: str - :keyword namespace: Namespace in which the resource exists. - :paramtype namespace: str - """ - super().__init__(**kwargs) - self.name = name - self.namespace = namespace - - -class OperationExtendedInfo(_serialization.Model): - """Operation Extended Info. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - OperationJobExtendedInfo - - All required parameters must be populated in order to send to 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}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - } - - _subtype_map = {"object_type": {"OperationJobExtendedInfo": "OperationJobExtendedInfo"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.object_type: Optional[str] = None - - -class OperationJobExtendedInfo(OperationExtendedInfo): - """Operation Job Extended Info. - - All required parameters must be populated in order to send to 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: Name or Arm Id of the job created for this operation. - :vartype job_id: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - } - - def __init__(self, *, job_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword job_id: Name or Arm Id of the job created for this operation. - :paramtype job_id: str - """ - super().__init__(**kwargs) - self.object_type: str = "OperationJobExtendedInfo" - self.job_id = job_id - - -class OperationResource(_serialization.Model): - """Operation Resource. - - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar error: Required if status == failed or status == canceled. This is the OData v4 error - format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - The full set of optional properties (e.g. inner errors / details) can be found in the "Error - Response" section. - :vartype error: ~azure.mgmt.dataprotection.models.Error - :ivar id: It should match what is used to GET the operation result. - :vartype id: str - :ivar name: It must match the last segment of the "id" field, and will typically be a GUID / - system generated value. - :vartype name: str - :ivar properties: End time of the operation. - :vartype properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar status: - :vartype status: str - """ - - _attribute_map = { - "end_time": {"key": "endTime", "type": "iso-8601"}, - "error": {"key": "error", "type": "Error"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "OperationExtendedInfo"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - end_time: Optional[datetime.datetime] = None, - error: Optional["_models.Error"] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - properties: Optional["_models.OperationExtendedInfo"] = None, - start_time: Optional[datetime.datetime] = None, - status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword end_time: End time of the operation. - :paramtype end_time: ~datetime.datetime - :keyword error: Required if status == failed or status == canceled. This is the OData v4 error - format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - The full set of optional properties (e.g. inner errors / details) can be found in the "Error - Response" section. - :paramtype error: ~azure.mgmt.dataprotection.models.Error - :keyword id: It should match what is used to GET the operation result. - :paramtype id: str - :keyword name: It must match the last segment of the "id" field, and will typically be a GUID / - system generated value. - :paramtype name: str - :keyword properties: End time of the operation. - :paramtype properties: ~azure.mgmt.dataprotection.models.OperationExtendedInfo - :keyword start_time: Start time of the operation. - :paramtype start_time: ~datetime.datetime - :keyword status: - :paramtype status: str - """ - super().__init__(**kwargs) - self.end_time = end_time - self.error = error - self.id = id - self.name = name - self.properties = properties - self.start_time = start_time - self.status = status - - -class PatchBackupVaultInput(_serialization.Model): - """Backup Vault Contract for Patch Backup Vault API. - - :ivar monitoring_settings: Monitoring Settings. - :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings - :ivar security_settings: Security Settings. - :vartype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings - :ivar feature_settings: Feature Settings. - :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - """ - - _attribute_map = { - "monitoring_settings": {"key": "monitoringSettings", "type": "MonitoringSettings"}, - "security_settings": {"key": "securitySettings", "type": "SecuritySettings"}, - "feature_settings": {"key": "featureSettings", "type": "FeatureSettings"}, - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - } - - def __init__( - self, - *, - monitoring_settings: Optional["_models.MonitoringSettings"] = None, - security_settings: Optional["_models.SecuritySettings"] = None, - feature_settings: Optional["_models.FeatureSettings"] = None, - resource_guard_operation_requests: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword monitoring_settings: Monitoring Settings. - :paramtype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings - :keyword security_settings: Security Settings. - :paramtype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings - :keyword feature_settings: Feature Settings. - :paramtype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - """ - super().__init__(**kwargs) - self.monitoring_settings = monitoring_settings - self.security_settings = security_settings - self.feature_settings = feature_settings - self.resource_guard_operation_requests = resource_guard_operation_requests - - -class PatchResourceGuardInput(_serialization.Model): - """Patch Request content for Microsoft.DataProtection Resource Guard resources. - - :ivar tags: Resource Guard tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource Guard tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class PatchResourceRequestInput(_serialization.Model): - """Patch Request content for Microsoft.DataProtection resources. - - :ivar identity: Input Managed Identity Details. - :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :ivar properties: Resource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.PatchBackupVaultInput - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "DppIdentityDetails"}, - "properties": {"key": "properties", "type": "PatchBackupVaultInput"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - identity: Optional["_models.DppIdentityDetails"] = None, - properties: Optional["_models.PatchBackupVaultInput"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Input Managed Identity Details. - :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails - :keyword properties: Resource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.PatchBackupVaultInput - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.identity = identity - self.properties = properties - self.tags = tags - - -class PolicyInfo(_serialization.Model): - """Policy Info in backupInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar policy_id: Required. - :vartype policy_id: str - :ivar policy_version: - :vartype policy_version: str - :ivar policy_parameters: Policy parameters for the backup instance. - :vartype policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters - """ - - _validation = { - "policy_id": {"required": True}, - "policy_version": {"readonly": True}, - } - - _attribute_map = { - "policy_id": {"key": "policyId", "type": "str"}, - "policy_version": {"key": "policyVersion", "type": "str"}, - "policy_parameters": {"key": "policyParameters", "type": "PolicyParameters"}, - } - - def __init__( - self, *, policy_id: str, policy_parameters: Optional["_models.PolicyParameters"] = None, **kwargs: Any - ) -> None: - """ - :keyword policy_id: Required. - :paramtype policy_id: str - :keyword policy_parameters: Policy parameters for the backup instance. - :paramtype policy_parameters: ~azure.mgmt.dataprotection.models.PolicyParameters - """ - super().__init__(**kwargs) - self.policy_id = policy_id - self.policy_version = None - self.policy_parameters = policy_parameters - - -class PolicyParameters(_serialization.Model): - """Parameters in Policy. - - :ivar data_store_parameters_list: Gets or sets the DataStore Parameters. - :vartype data_store_parameters_list: - list[~azure.mgmt.dataprotection.models.DataStoreParameters] - :ivar backup_datasource_parameters_list: Gets or sets the Backup Data Source Parameters. - :vartype backup_datasource_parameters_list: - list[~azure.mgmt.dataprotection.models.BackupDatasourceParameters] - """ - - _attribute_map = { - "data_store_parameters_list": {"key": "dataStoreParametersList", "type": "[DataStoreParameters]"}, - "backup_datasource_parameters_list": { - "key": "backupDatasourceParametersList", - "type": "[BackupDatasourceParameters]", - }, - } - - def __init__( - self, - *, - data_store_parameters_list: Optional[List["_models.DataStoreParameters"]] = None, - backup_datasource_parameters_list: Optional[List["_models.BackupDatasourceParameters"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword data_store_parameters_list: Gets or sets the DataStore Parameters. - :paramtype data_store_parameters_list: - list[~azure.mgmt.dataprotection.models.DataStoreParameters] - :keyword backup_datasource_parameters_list: Gets or sets the Backup Data Source Parameters. - :paramtype backup_datasource_parameters_list: - list[~azure.mgmt.dataprotection.models.BackupDatasourceParameters] - """ - super().__init__(**kwargs) - self.data_store_parameters_list = data_store_parameters_list - self.backup_datasource_parameters_list = backup_datasource_parameters_list - - -class ProtectionStatusDetails(_serialization.Model): - """Protection status details. - - :ivar error_details: Specifies the protection status error of the resource. - :vartype error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :ivar status: Specifies the protection status of the resource. Known values are: - "ConfiguringProtection", "ConfiguringProtectionFailed", "ProtectionConfigured", - "ProtectionStopped", "SoftDeleted", and "SoftDeleting". - :vartype status: str or ~azure.mgmt.dataprotection.models.Status - """ - - _attribute_map = { - "error_details": {"key": "errorDetails", "type": "UserFacingError"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - error_details: Optional["_models.UserFacingError"] = None, - status: Optional[Union[str, "_models.Status"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword error_details: Specifies the protection status error of the resource. - :paramtype error_details: ~azure.mgmt.dataprotection.models.UserFacingError - :keyword status: Specifies the protection status of the resource. Known values are: - "ConfiguringProtection", "ConfiguringProtectionFailed", "ProtectionConfigured", - "ProtectionStopped", "SoftDeleted", and "SoftDeleting". - :paramtype status: str or ~azure.mgmt.dataprotection.models.Status - """ - super().__init__(**kwargs) - self.error_details = error_details - self.status = status - - -class RangeBasedItemLevelRestoreCriteria(ItemLevelRestoreCriteria): - """Item Level target info for restore operation. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar min_matching_value: minimum value for range prefix match. - :vartype min_matching_value: str - :ivar max_matching_value: maximum value for range prefix match. - :vartype max_matching_value: str - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "min_matching_value": {"key": "minMatchingValue", "type": "str"}, - "max_matching_value": {"key": "maxMatchingValue", "type": "str"}, - } - - def __init__( - self, *, min_matching_value: Optional[str] = None, max_matching_value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword min_matching_value: minimum value for range prefix match. - :paramtype min_matching_value: str - :keyword max_matching_value: maximum value for range prefix match. - :paramtype max_matching_value: str - """ - super().__init__(**kwargs) - self.object_type: str = "RangeBasedItemLevelRestoreCriteria" - self.min_matching_value = min_matching_value - self.max_matching_value = max_matching_value - - -class RecoveryPointDataStoreDetails(_serialization.Model): - """RecoveryPoint datastore details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar creation_time: - :vartype creation_time: ~datetime.datetime - :ivar expiry_time: - :vartype expiry_time: ~datetime.datetime - :ivar id: - :vartype id: str - :ivar meta_data: - :vartype meta_data: str - :ivar state: - :vartype state: str - :ivar type: - :vartype type: str - :ivar visible: - :vartype visible: bool - :ivar rehydration_expiry_time: - :vartype rehydration_expiry_time: ~datetime.datetime - :ivar rehydration_status: Known values are: "CREATE_IN_PROGRESS", "COMPLETED", - "DELETE_IN_PROGRESS", "DELETED", and "FAILED". - :vartype rehydration_status: str or ~azure.mgmt.dataprotection.models.RehydrationStatus - """ - - _validation = { - "rehydration_expiry_time": {"readonly": True}, - "rehydration_status": {"readonly": True}, - } - - _attribute_map = { - "creation_time": {"key": "creationTime", "type": "iso-8601"}, - "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, - "id": {"key": "id", "type": "str"}, - "meta_data": {"key": "metaData", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "visible": {"key": "visible", "type": "bool"}, - "rehydration_expiry_time": {"key": "rehydrationExpiryTime", "type": "iso-8601"}, - "rehydration_status": {"key": "rehydrationStatus", "type": "str"}, - } - - def __init__( - self, - *, - creation_time: Optional[datetime.datetime] = None, - expiry_time: Optional[datetime.datetime] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - meta_data: Optional[str] = None, - state: Optional[str] = None, - type: Optional[str] = None, - visible: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword creation_time: - :paramtype creation_time: ~datetime.datetime - :keyword expiry_time: - :paramtype expiry_time: ~datetime.datetime - :keyword id: - :paramtype id: str - :keyword meta_data: - :paramtype meta_data: str - :keyword state: - :paramtype state: str - :keyword type: - :paramtype type: str - :keyword visible: - :paramtype visible: bool - """ - super().__init__(**kwargs) - self.creation_time = creation_time - self.expiry_time = expiry_time - self.id = id - self.meta_data = meta_data - self.state = state - self.type = type - self.visible = visible - self.rehydration_expiry_time = None - self.rehydration_status = None - - -class RecoveryPointsFilters(_serialization.Model): - """RecoveryPointsFilters. - - :ivar restore_point_data_store_id: - :vartype restore_point_data_store_id: str - :ivar is_visible: - :vartype is_visible: bool - :ivar start_date: - :vartype start_date: str - :ivar end_date: - :vartype end_date: str - :ivar extended_info: - :vartype extended_info: bool - :ivar restore_point_state: - :vartype restore_point_state: str - """ - - _attribute_map = { - "restore_point_data_store_id": {"key": "restorePointDataStoreId", "type": "str"}, - "is_visible": {"key": "isVisible", "type": "bool"}, - "start_date": {"key": "startDate", "type": "str"}, - "end_date": {"key": "endDate", "type": "str"}, - "extended_info": {"key": "extendedInfo", "type": "bool"}, - "restore_point_state": {"key": "restorePointState", "type": "str"}, - } - - def __init__( - self, - *, - restore_point_data_store_id: Optional[str] = None, - is_visible: Optional[bool] = None, - start_date: Optional[str] = None, - end_date: Optional[str] = None, - extended_info: Optional[bool] = None, - restore_point_state: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword restore_point_data_store_id: - :paramtype restore_point_data_store_id: str - :keyword is_visible: - :paramtype is_visible: bool - :keyword start_date: - :paramtype start_date: str - :keyword end_date: - :paramtype end_date: str - :keyword extended_info: - :paramtype extended_info: bool - :keyword restore_point_state: - :paramtype restore_point_state: str - """ - super().__init__(**kwargs) - self.restore_point_data_store_id = restore_point_data_store_id - self.is_visible = is_visible - self.start_date = start_date - self.end_date = end_date - self.extended_info = extended_info - self.restore_point_state = restore_point_state - - -class ResourceGuard(_serialization.Model): - """ResourceGuard. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the BackupVault resource. Known values are: - "Failed", "Provisioning", "Succeeded", "Unknown", and "Updating". - :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState - :ivar allow_auto_approvals: This flag indicates whether auto approval is allowed or not. - :vartype allow_auto_approvals: bool - :ivar resource_guard_operations: {readonly} List of operation details those are protected by - the ResourceGuard resource. - :vartype resource_guard_operations: - list[~azure.mgmt.dataprotection.models.ResourceGuardOperation] - :ivar vault_critical_operation_exclusion_list: List of critical operations which are not - protected by this resourceGuard. - :vartype vault_critical_operation_exclusion_list: list[str] - :ivar description: Description about the pre-req steps to perform all the critical operations. - :vartype description: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "allow_auto_approvals": {"readonly": True}, - "resource_guard_operations": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "allow_auto_approvals": {"key": "allowAutoApprovals", "type": "bool"}, - "resource_guard_operations": {"key": "resourceGuardOperations", "type": "[ResourceGuardOperation]"}, - "vault_critical_operation_exclusion_list": {"key": "vaultCriticalOperationExclusionList", "type": "[str]"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, *, vault_critical_operation_exclusion_list: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword vault_critical_operation_exclusion_list: List of critical operations which are not - protected by this resourceGuard. - :paramtype vault_critical_operation_exclusion_list: list[str] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.allow_auto_approvals = None - self.resource_guard_operations = None - self.vault_critical_operation_exclusion_list = vault_critical_operation_exclusion_list - self.description = None - - -class ResourceGuardOperation(_serialization.Model): - """This class contains all the details about a critical operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vault_critical_operation: Name of the critical operation. - :vartype vault_critical_operation: str - :ivar request_resource_type: Type of resource request. - :vartype request_resource_type: str - """ - - _validation = { - "vault_critical_operation": {"readonly": True}, - "request_resource_type": {"readonly": True}, - } - - _attribute_map = { - "vault_critical_operation": {"key": "vaultCriticalOperation", "type": "str"}, - "request_resource_type": {"key": "requestResourceType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.vault_critical_operation = None - self.request_resource_type = None - - -class ResourceGuardOperationDetail(_serialization.Model): - """VaultCritical Operation protected by a resource guard. - - :ivar vault_critical_operation: - :vartype vault_critical_operation: str - :ivar default_resource_request: - :vartype default_resource_request: str - """ - - _attribute_map = { - "vault_critical_operation": {"key": "vaultCriticalOperation", "type": "str"}, - "default_resource_request": {"key": "defaultResourceRequest", "type": "str"}, - } - - def __init__( - self, - *, - vault_critical_operation: Optional[str] = None, - default_resource_request: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword vault_critical_operation: - :paramtype vault_critical_operation: str - :keyword default_resource_request: - :paramtype default_resource_request: str - """ - super().__init__(**kwargs) - self.vault_critical_operation = vault_critical_operation - self.default_resource_request = default_resource_request - - -class ResourceGuardProxyBase(_serialization.Model): - """ResourceGuardProxyBase object, used in ResourceGuardProxyBaseResource. - - :ivar resource_guard_resource_id: - :vartype resource_guard_resource_id: str - :ivar resource_guard_operation_details: - :vartype resource_guard_operation_details: - list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] - :ivar last_updated_time: - :vartype last_updated_time: str - :ivar description: - :vartype description: str - """ - - _attribute_map = { - "resource_guard_resource_id": {"key": "resourceGuardResourceId", "type": "str"}, - "resource_guard_operation_details": { - "key": "resourceGuardOperationDetails", - "type": "[ResourceGuardOperationDetail]", - }, - "last_updated_time": {"key": "lastUpdatedTime", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - resource_guard_resource_id: Optional[str] = None, - resource_guard_operation_details: Optional[List["_models.ResourceGuardOperationDetail"]] = None, - last_updated_time: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_guard_resource_id: - :paramtype resource_guard_resource_id: str - :keyword resource_guard_operation_details: - :paramtype resource_guard_operation_details: - list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] - :keyword last_updated_time: - :paramtype last_updated_time: str - :keyword description: - :paramtype description: str - """ - super().__init__(**kwargs) - self.resource_guard_resource_id = resource_guard_resource_id - self.resource_guard_operation_details = resource_guard_operation_details - self.last_updated_time = last_updated_time - self.description = description - - -class ResourceGuardProxyBaseResource(DppResource): - """ResourceGuardProxyBaseResource object, used for response and request bodies for - ResourceGuardProxy APIs. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: ResourceGuardProxyBaseResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ResourceGuardProxyBase"}, - } - - def __init__(self, *, properties: Optional["_models.ResourceGuardProxyBase"] = None, **kwargs: Any) -> None: - """ - :keyword properties: ResourceGuardProxyBaseResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase - """ - super().__init__(**kwargs) - self.properties = properties - - -class ResourceGuardProxyBaseResourceList(DppResourceList): - """List of ResourceGuardProxyBase resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ResourceGuardProxyBaseResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ResourceGuardProxyBaseResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class ResourceGuardResource(DppBaseTrackedResource): - """ResourceGuardResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar e_tag: Optional ETag. - :vartype e_tag: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar location: Resource location. - :vartype location: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: ResourceGuardResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuard - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "e_tag": {"key": "eTag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ResourceGuard"}, - } - - def __init__( - self, - *, - e_tag: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.ResourceGuard"] = None, - **kwargs: Any - ) -> None: - """ - :keyword e_tag: Optional ETag. - :paramtype e_tag: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: ResourceGuardResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuard - """ - super().__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) - self.properties = properties - - -class ResourceGuardResourceList(DppTrackedResourceList): - """List of ResourceGuard resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.ResourceGuardResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ResourceGuardResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ResourceGuardResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.ResourceGuardResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class ResourceMoveDetails(_serialization.Model): - """ResourceMoveDetails will be returned in response to GetResource call from ARM. - - :ivar operation_id: CorrelationId of latest ResourceMove operation attempted. - :vartype operation_id: str - :ivar start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 - format. - :vartype start_time_utc: str - :ivar completion_time_utc: Completion time in UTC of latest ResourceMove operation attempted. - ISO 8601 format. - :vartype completion_time_utc: str - :ivar source_resource_path: ARM resource path of source resource. - :vartype source_resource_path: str - :ivar target_resource_path: ARM resource path of target resource used in latest ResourceMove - operation. - :vartype target_resource_path: str - """ - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - "start_time_utc": {"key": "startTimeUtc", "type": "str"}, - "completion_time_utc": {"key": "completionTimeUtc", "type": "str"}, - "source_resource_path": {"key": "sourceResourcePath", "type": "str"}, - "target_resource_path": {"key": "targetResourcePath", "type": "str"}, - } - - def __init__( - self, - *, - operation_id: Optional[str] = None, - start_time_utc: Optional[str] = None, - completion_time_utc: Optional[str] = None, - source_resource_path: Optional[str] = None, - target_resource_path: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword operation_id: CorrelationId of latest ResourceMove operation attempted. - :paramtype operation_id: str - :keyword start_time_utc: Start time in UTC of latest ResourceMove operation attempted. ISO 8601 - format. - :paramtype start_time_utc: str - :keyword completion_time_utc: Completion time in UTC of latest ResourceMove operation - attempted. ISO 8601 format. - :paramtype completion_time_utc: str - :keyword source_resource_path: ARM resource path of source resource. - :paramtype source_resource_path: str - :keyword target_resource_path: ARM resource path of target resource used in latest ResourceMove - operation. - :paramtype target_resource_path: str - """ - super().__init__(**kwargs) - self.operation_id = operation_id - self.start_time_utc = start_time_utc - self.completion_time_utc = completion_time_utc - self.source_resource_path = source_resource_path - self.target_resource_path = target_resource_path - - -class RestorableTimeRange(_serialization.Model): - """RestorableTimeRange. - - All required parameters must be populated in order to send to server. - - :ivar start_time: Start time for the available restore range. Required. - :vartype start_time: str - :ivar end_time: End time for the available restore range. Required. - :vartype end_time: str - :ivar object_type: - :vartype object_type: str - """ - - _validation = { - "start_time": {"required": True}, - "end_time": {"required": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "str"}, - "end_time": {"key": "endTime", "type": "str"}, - "object_type": {"key": "objectType", "type": "str"}, - } - - def __init__(self, *, start_time: str, end_time: str, object_type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword start_time: Start time for the available restore range. Required. - :paramtype start_time: str - :keyword end_time: End time for the available restore range. Required. - :paramtype end_time: str - :keyword object_type: - :paramtype object_type: str - """ - super().__init__(**kwargs) - self.start_time = start_time - self.end_time = end_time - self.object_type = object_type - - -class RestoreFilesTargetInfo(RestoreTargetInfoBase): - """Class encapsulating restore as files target parameters. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - Required. - :vartype object_type: str - :ivar recovery_option: Recovery Option. Required. "FailIfExists" - :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :ivar restore_location: Target Restore region. - :vartype restore_location: str - :ivar target_details: Destination of RestoreAsFiles operation, when destination is not a - datasource. Required. - :vartype target_details: ~azure.mgmt.dataprotection.models.TargetDetails - """ - - _validation = { - "object_type": {"required": True}, - "recovery_option": {"required": True}, - "target_details": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "recovery_option": {"key": "recoveryOption", "type": "str"}, - "restore_location": {"key": "restoreLocation", "type": "str"}, - "target_details": {"key": "targetDetails", "type": "TargetDetails"}, - } - - def __init__( - self, - *, - recovery_option: Union[str, "_models.RecoveryOption"], - target_details: "_models.TargetDetails", - restore_location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_option: Recovery Option. Required. "FailIfExists" - :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :keyword restore_location: Target Restore region. - :paramtype restore_location: str - :keyword target_details: Destination of RestoreAsFiles operation, when destination is not a - datasource. Required. - :paramtype target_details: ~azure.mgmt.dataprotection.models.TargetDetails - """ - super().__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) - self.object_type: str = "RestoreFilesTargetInfo" - self.target_details = target_details - - -class RestoreJobRecoveryPointDetails(_serialization.Model): - """RestoreJobRecoveryPointDetails. - - :ivar recovery_point_id: - :vartype recovery_point_id: str - :ivar recovery_point_time: - :vartype recovery_point_time: ~datetime.datetime - """ - - _attribute_map = { - "recovery_point_id": {"key": "recoveryPointID", "type": "str"}, - "recovery_point_time": {"key": "recoveryPointTime", "type": "iso-8601"}, - } - - def __init__( - self, - *, - recovery_point_id: Optional[str] = None, - recovery_point_time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_point_id: - :paramtype recovery_point_id: str - :keyword recovery_point_time: - :paramtype recovery_point_time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.recovery_point_id = recovery_point_id - self.recovery_point_time = recovery_point_time - - -class RestoreTargetInfo(RestoreTargetInfoBase): - """Class encapsulating restore target parameters. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of Datasource object, used to initialize the right inherited type. - Required. - :vartype object_type: str - :ivar recovery_option: Recovery Option. Required. "FailIfExists" - :vartype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :ivar restore_location: Target Restore region. - :vartype restore_location: str - :ivar datasource_info: Information of target DS. Required. - :vartype datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :ivar datasource_set_info: Information of target DS Set. - :vartype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :ivar datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :vartype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - """ - - _validation = { - "object_type": {"required": True}, - "recovery_option": {"required": True}, - "datasource_info": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "recovery_option": {"key": "recoveryOption", "type": "str"}, - "restore_location": {"key": "restoreLocation", "type": "str"}, - "datasource_info": {"key": "datasourceInfo", "type": "Datasource"}, - "datasource_set_info": {"key": "datasourceSetInfo", "type": "DatasourceSet"}, - "datasource_auth_credentials": {"key": "datasourceAuthCredentials", "type": "AuthCredentials"}, - } - - def __init__( - self, - *, - recovery_option: Union[str, "_models.RecoveryOption"], - datasource_info: "_models.Datasource", - restore_location: Optional[str] = None, - datasource_set_info: Optional["_models.DatasourceSet"] = None, - datasource_auth_credentials: Optional["_models.AuthCredentials"] = None, - **kwargs: Any - ) -> None: - """ - :keyword recovery_option: Recovery Option. Required. "FailIfExists" - :paramtype recovery_option: str or ~azure.mgmt.dataprotection.models.RecoveryOption - :keyword restore_location: Target Restore region. - :paramtype restore_location: str - :keyword datasource_info: Information of target DS. Required. - :paramtype datasource_info: ~azure.mgmt.dataprotection.models.Datasource - :keyword datasource_set_info: Information of target DS Set. - :paramtype datasource_set_info: ~azure.mgmt.dataprotection.models.DatasourceSet - :keyword datasource_auth_credentials: Credentials to use to authenticate with data source - provider. - :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials - """ - super().__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) - self.object_type: str = "RestoreTargetInfo" - self.datasource_info = datasource_info - self.datasource_set_info = datasource_set_info - self.datasource_auth_credentials = datasource_auth_credentials - - -class RetentionTag(_serialization.Model): - """Retention tag. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar e_tag: Retention Tag version. - :vartype e_tag: str - :ivar id: Retention Tag version. - :vartype id: str - :ivar tag_name: Retention Tag Name to relate it to retention rule. Required. - :vartype tag_name: str - """ - - _validation = { - "e_tag": {"readonly": True}, - "id": {"readonly": True}, - "tag_name": {"required": True}, - } - - _attribute_map = { - "e_tag": {"key": "eTag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "tag_name": {"key": "tagName", "type": "str"}, - } - - def __init__(self, *, tag_name: str, **kwargs: Any) -> None: - """ - :keyword tag_name: Retention Tag Name to relate it to retention rule. Required. - :paramtype tag_name: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.id = None - self.tag_name = tag_name - - -class ScheduleBasedBackupCriteria(BackupCriteria): - """Schedule based backup criteria. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / - "FirstOfWeek" / "FirstOfMonth" - and should be part of AbsoluteMarker enum. - :vartype absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] - :ivar days_of_month: This is day of the month from 1 to 28 other wise last of month. - :vartype days_of_month: list[~azure.mgmt.dataprotection.models.Day] - :ivar days_of_the_week: It should be Sunday/Monday/T..../Saturday. - :vartype days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] - :ivar months_of_year: It should be January/February/....../December. - :vartype months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] - :ivar schedule_times: List of schedule times for backup. - :vartype schedule_times: list[~datetime.datetime] - :ivar weeks_of_the_month: It should be First/Second/Third/Fourth/Last. - :vartype weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "absolute_criteria": {"key": "absoluteCriteria", "type": "[str]"}, - "days_of_month": {"key": "daysOfMonth", "type": "[Day]"}, - "days_of_the_week": {"key": "daysOfTheWeek", "type": "[str]"}, - "months_of_year": {"key": "monthsOfYear", "type": "[str]"}, - "schedule_times": {"key": "scheduleTimes", "type": "[iso-8601]"}, - "weeks_of_the_month": {"key": "weeksOfTheMonth", "type": "[str]"}, - } - - def __init__( - self, - *, - absolute_criteria: Optional[List[Union[str, "_models.AbsoluteMarker"]]] = None, - days_of_month: Optional[List["_models.Day"]] = None, - days_of_the_week: Optional[List[Union[str, "_models.DayOfWeek"]]] = None, - months_of_year: Optional[List[Union[str, "_models.Month"]]] = None, - schedule_times: Optional[List[datetime.datetime]] = None, - weeks_of_the_month: Optional[List[Union[str, "_models.WeekNumber"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword absolute_criteria: it contains absolute values like "AllBackup" / "FirstOfDay" / - "FirstOfWeek" / "FirstOfMonth" - and should be part of AbsoluteMarker enum. - :paramtype absolute_criteria: list[str or ~azure.mgmt.dataprotection.models.AbsoluteMarker] - :keyword days_of_month: This is day of the month from 1 to 28 other wise last of month. - :paramtype days_of_month: list[~azure.mgmt.dataprotection.models.Day] - :keyword days_of_the_week: It should be Sunday/Monday/T..../Saturday. - :paramtype days_of_the_week: list[str or ~azure.mgmt.dataprotection.models.DayOfWeek] - :keyword months_of_year: It should be January/February/....../December. - :paramtype months_of_year: list[str or ~azure.mgmt.dataprotection.models.Month] - :keyword schedule_times: List of schedule times for backup. - :paramtype schedule_times: list[~datetime.datetime] - :keyword weeks_of_the_month: It should be First/Second/Third/Fourth/Last. - :paramtype weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] - """ - super().__init__(**kwargs) - self.object_type: str = "ScheduleBasedBackupCriteria" - self.absolute_criteria = absolute_criteria - self.days_of_month = days_of_month - self.days_of_the_week = days_of_the_week - self.months_of_year = months_of_year - self.schedule_times = schedule_times - self.weeks_of_the_month = weeks_of_the_month - - -class ScheduleBasedTriggerContext(TriggerContext): - """Schedule based trigger context. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar schedule: Schedule for this backup. Required. - :vartype schedule: ~azure.mgmt.dataprotection.models.BackupSchedule - :ivar tagging_criteria: List of tags that can be applicable for given schedule. Required. - :vartype tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] - """ - - _validation = { - "object_type": {"required": True}, - "schedule": {"required": True}, - "tagging_criteria": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "schedule": {"key": "schedule", "type": "BackupSchedule"}, - "tagging_criteria": {"key": "taggingCriteria", "type": "[TaggingCriteria]"}, - } - - def __init__( - self, *, schedule: "_models.BackupSchedule", tagging_criteria: List["_models.TaggingCriteria"], **kwargs: Any - ) -> None: - """ - :keyword schedule: Schedule for this backup. Required. - :paramtype schedule: ~azure.mgmt.dataprotection.models.BackupSchedule - :keyword tagging_criteria: List of tags that can be applicable for given schedule. Required. - :paramtype tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] - """ - super().__init__(**kwargs) - self.object_type: str = "ScheduleBasedTriggerContext" - self.schedule = schedule - self.tagging_criteria = tagging_criteria - - -class SecretStoreBasedAuthCredentials(AuthCredentials): - """Secret store based authentication credentials. - - All required parameters must be populated in order to send to server. - - :ivar object_type: Type of the specific object - used for deserializing. Required. - :vartype object_type: str - :ivar secret_store_resource: Secret store resource. - :vartype secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource - """ - - _validation = { - "object_type": {"required": True}, - } - - _attribute_map = { - "object_type": {"key": "objectType", "type": "str"}, - "secret_store_resource": {"key": "secretStoreResource", "type": "SecretStoreResource"}, - } - - def __init__(self, *, secret_store_resource: Optional["_models.SecretStoreResource"] = None, **kwargs: Any) -> None: - """ - :keyword secret_store_resource: Secret store resource. - :paramtype secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource - """ - super().__init__(**kwargs) - self.object_type: str = "SecretStoreBasedAuthCredentials" - self.secret_store_resource = secret_store_resource - - -class SecretStoreResource(_serialization.Model): - """Class representing a secret store resource. - - All required parameters must be populated in order to send to server. - - :ivar uri: Uri to get to the resource. - :vartype uri: str - :ivar secret_store_type: Gets or sets the type of secret store. Required. Known values are: - "Invalid" and "AzureKeyVault". - :vartype secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType - :ivar value: Gets or sets value stored in secret store resource. - :vartype value: str - """ - - _validation = { - "secret_store_type": {"required": True}, - } - - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - "secret_store_type": {"key": "secretStoreType", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__( - self, - *, - secret_store_type: Union[str, "_models.SecretStoreType"], - uri: Optional[str] = None, - value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword uri: Uri to get to the resource. - :paramtype uri: str - :keyword secret_store_type: Gets or sets the type of secret store. Required. Known values are: - "Invalid" and "AzureKeyVault". - :paramtype secret_store_type: str or ~azure.mgmt.dataprotection.models.SecretStoreType - :keyword value: Gets or sets value stored in secret store resource. - :paramtype value: str - """ - super().__init__(**kwargs) - self.uri = uri - self.secret_store_type = secret_store_type - self.value = value - - -class SecuritySettings(_serialization.Model): - """Class containing security settings of vault. - - :ivar soft_delete_settings: Soft delete related settings. - :vartype soft_delete_settings: ~azure.mgmt.dataprotection.models.SoftDeleteSettings - :ivar immutability_settings: Immutability Settings at vault level. - :vartype immutability_settings: ~azure.mgmt.dataprotection.models.ImmutabilitySettings - :ivar encryption_settings: Customer Managed Key details of the resource. - :vartype encryption_settings: ~azure.mgmt.dataprotection.models.EncryptionSettings - """ - - _attribute_map = { - "soft_delete_settings": {"key": "softDeleteSettings", "type": "SoftDeleteSettings"}, - "immutability_settings": {"key": "immutabilitySettings", "type": "ImmutabilitySettings"}, - "encryption_settings": {"key": "encryptionSettings", "type": "EncryptionSettings"}, - } - - def __init__( - self, - *, - soft_delete_settings: Optional["_models.SoftDeleteSettings"] = None, - immutability_settings: Optional["_models.ImmutabilitySettings"] = None, - encryption_settings: Optional["_models.EncryptionSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword soft_delete_settings: Soft delete related settings. - :paramtype soft_delete_settings: ~azure.mgmt.dataprotection.models.SoftDeleteSettings - :keyword immutability_settings: Immutability Settings at vault level. - :paramtype immutability_settings: ~azure.mgmt.dataprotection.models.ImmutabilitySettings - :keyword encryption_settings: Customer Managed Key details of the resource. - :paramtype encryption_settings: ~azure.mgmt.dataprotection.models.EncryptionSettings - """ - super().__init__(**kwargs) - self.soft_delete_settings = soft_delete_settings - self.immutability_settings = immutability_settings - self.encryption_settings = encryption_settings - - -class SoftDeleteSettings(_serialization.Model): - """Soft delete related settings. - - :ivar state: State of soft delete. Known values are: "Off", "On", and "AlwaysOn". - :vartype state: str or ~azure.mgmt.dataprotection.models.SoftDeleteState - :ivar retention_duration_in_days: Soft delete retention duration. - :vartype retention_duration_in_days: float - """ - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "retention_duration_in_days": {"key": "retentionDurationInDays", "type": "float"}, - } - - def __init__( - self, - *, - state: Optional[Union[str, "_models.SoftDeleteState"]] = None, - retention_duration_in_days: Optional[float] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: State of soft delete. Known values are: "Off", "On", and "AlwaysOn". - :paramtype state: str or ~azure.mgmt.dataprotection.models.SoftDeleteState - :keyword retention_duration_in_days: Soft delete retention duration. - :paramtype retention_duration_in_days: float - """ - super().__init__(**kwargs) - self.state = state - self.retention_duration_in_days = retention_duration_in_days - - -class SourceLifeCycle(_serialization.Model): - """Source LifeCycle. - - All required parameters must be populated in order to send to server. - - :ivar delete_after: Delete Option. Required. - :vartype delete_after: ~azure.mgmt.dataprotection.models.DeleteOption - :ivar source_data_store: DataStoreInfo base. Required. - :vartype source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :ivar target_data_store_copy_settings: - :vartype target_data_store_copy_settings: - list[~azure.mgmt.dataprotection.models.TargetCopySetting] - """ - - _validation = { - "delete_after": {"required": True}, - "source_data_store": {"required": True}, - } - - _attribute_map = { - "delete_after": {"key": "deleteAfter", "type": "DeleteOption"}, - "source_data_store": {"key": "sourceDataStore", "type": "DataStoreInfoBase"}, - "target_data_store_copy_settings": {"key": "targetDataStoreCopySettings", "type": "[TargetCopySetting]"}, - } - - def __init__( - self, - *, - delete_after: "_models.DeleteOption", - source_data_store: "_models.DataStoreInfoBase", - target_data_store_copy_settings: Optional[List["_models.TargetCopySetting"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword delete_after: Delete Option. Required. - :paramtype delete_after: ~azure.mgmt.dataprotection.models.DeleteOption - :keyword source_data_store: DataStoreInfo base. Required. - :paramtype source_data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - :keyword target_data_store_copy_settings: - :paramtype target_data_store_copy_settings: - list[~azure.mgmt.dataprotection.models.TargetCopySetting] - """ - super().__init__(**kwargs) - self.delete_after = delete_after - self.source_data_store = source_data_store - self.target_data_store_copy_settings = target_data_store_copy_settings - - -class StopProtectionRequest(_serialization.Model): - """Request body of Stop protection when MUA is Enabled. - - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - """ - - _attribute_map = { - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - } - - def __init__(self, *, resource_guard_operation_requests: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - """ - super().__init__(**kwargs) - self.resource_guard_operation_requests = resource_guard_operation_requests - - -class StorageSetting(_serialization.Model): - """Storage setting. - - :ivar datastore_type: Gets or sets the type of the datastore. Known values are: "ArchiveStore", - "OperationalStore", and "VaultStore". - :vartype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes - :ivar type: Gets or sets the type. Known values are: "GeoRedundant", "LocallyRedundant", and - "ZoneRedundant". - :vartype type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes - """ - - _attribute_map = { - "datastore_type": {"key": "datastoreType", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - datastore_type: Optional[Union[str, "_models.StorageSettingStoreTypes"]] = None, - type: Optional[Union[str, "_models.StorageSettingTypes"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword datastore_type: Gets or sets the type of the datastore. Known values are: - "ArchiveStore", "OperationalStore", and "VaultStore". - :paramtype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes - :keyword type: Gets or sets the type. Known values are: "GeoRedundant", "LocallyRedundant", and - "ZoneRedundant". - :paramtype type: str or ~azure.mgmt.dataprotection.models.StorageSettingTypes - """ - super().__init__(**kwargs) - self.datastore_type = datastore_type - self.type = type - - -class SupportedFeature(_serialization.Model): - """Elements class for feature request. - - :ivar feature_name: support feature type. - :vartype feature_name: str - :ivar support_status: feature support status. Known values are: "Invalid", "NotSupported", - "AlphaPreview", "PrivatePreview", "PublicPreview", and "GenerallyAvailable". - :vartype support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus - :ivar exposure_controlled_features: support feature type. - :vartype exposure_controlled_features: list[str] - """ - - _attribute_map = { - "feature_name": {"key": "featureName", "type": "str"}, - "support_status": {"key": "supportStatus", "type": "str"}, - "exposure_controlled_features": {"key": "exposureControlledFeatures", "type": "[str]"}, - } - - def __init__( - self, - *, - feature_name: Optional[str] = None, - support_status: Optional[Union[str, "_models.FeatureSupportStatus"]] = None, - exposure_controlled_features: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword feature_name: support feature type. - :paramtype feature_name: str - :keyword support_status: feature support status. Known values are: "Invalid", "NotSupported", - "AlphaPreview", "PrivatePreview", "PublicPreview", and "GenerallyAvailable". - :paramtype support_status: str or ~azure.mgmt.dataprotection.models.FeatureSupportStatus - :keyword exposure_controlled_features: support feature type. - :paramtype exposure_controlled_features: list[str] - """ - super().__init__(**kwargs) - self.feature_name = feature_name - self.support_status = support_status - self.exposure_controlled_features = exposure_controlled_features - - -class SuspendBackupRequest(_serialization.Model): - """Request body of Suspend backup when MUA is Enabled. - - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - """ - - _attribute_map = { - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - } - - def __init__(self, *, resource_guard_operation_requests: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - """ - super().__init__(**kwargs) - self.resource_guard_operation_requests = resource_guard_operation_requests - - -class SyncBackupInstanceRequest(_serialization.Model): - """Sync BackupInstance Request. - - :ivar sync_type: Field indicating sync type e.g. to sync only in case of failure or in all - cases. Known values are: "Default" and "ForceResync". - :vartype sync_type: str or ~azure.mgmt.dataprotection.models.SyncType - """ - - _attribute_map = { - "sync_type": {"key": "syncType", "type": "str"}, - } - - def __init__(self, *, sync_type: Optional[Union[str, "_models.SyncType"]] = None, **kwargs: Any) -> None: - """ - :keyword sync_type: Field indicating sync type e.g. to sync only in case of failure or in all - cases. Known values are: "Default" and "ForceResync". - :paramtype sync_type: str or ~azure.mgmt.dataprotection.models.SyncType - """ - super().__init__(**kwargs) - self.sync_type = sync_type - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.dataprotection.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TaggingCriteria(_serialization.Model): - """Tagging criteria. - - All required parameters must be populated in order to send to server. - - :ivar criteria: Criteria which decides whether the tag can be applied to a triggered backup. - :vartype criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] - :ivar is_default: Specifies if tag is default. Required. - :vartype is_default: bool - :ivar tagging_priority: Retention Tag priority. Required. - :vartype tagging_priority: int - :ivar tag_info: Retention tag information. Required. - :vartype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag - """ - - _validation = { - "is_default": {"required": True}, - "tagging_priority": {"required": True}, - "tag_info": {"required": True}, - } - - _attribute_map = { - "criteria": {"key": "criteria", "type": "[BackupCriteria]"}, - "is_default": {"key": "isDefault", "type": "bool"}, - "tagging_priority": {"key": "taggingPriority", "type": "int"}, - "tag_info": {"key": "tagInfo", "type": "RetentionTag"}, - } - - def __init__( - self, - *, - is_default: bool, - tagging_priority: int, - tag_info: "_models.RetentionTag", - criteria: Optional[List["_models.BackupCriteria"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword criteria: Criteria which decides whether the tag can be applied to a triggered backup. - :paramtype criteria: list[~azure.mgmt.dataprotection.models.BackupCriteria] - :keyword is_default: Specifies if tag is default. Required. - :paramtype is_default: bool - :keyword tagging_priority: Retention Tag priority. Required. - :paramtype tagging_priority: int - :keyword tag_info: Retention tag information. Required. - :paramtype tag_info: ~azure.mgmt.dataprotection.models.RetentionTag - """ - super().__init__(**kwargs) - self.criteria = criteria - self.is_default = is_default - self.tagging_priority = tagging_priority - self.tag_info = tag_info - - -class TargetCopySetting(_serialization.Model): - """Target copy settings. - - All required parameters must be populated in order to send to server. - - :ivar copy_after: It can be CustomCopyOption or ImmediateCopyOption. Required. - :vartype copy_after: ~azure.mgmt.dataprotection.models.CopyOption - :ivar data_store: Info of target datastore. Required. - :vartype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - """ - - _validation = { - "copy_after": {"required": True}, - "data_store": {"required": True}, - } - - _attribute_map = { - "copy_after": {"key": "copyAfter", "type": "CopyOption"}, - "data_store": {"key": "dataStore", "type": "DataStoreInfoBase"}, - } - - def __init__( - self, *, copy_after: "_models.CopyOption", data_store: "_models.DataStoreInfoBase", **kwargs: Any - ) -> None: - """ - :keyword copy_after: It can be CustomCopyOption or ImmediateCopyOption. Required. - :paramtype copy_after: ~azure.mgmt.dataprotection.models.CopyOption - :keyword data_store: Info of target datastore. Required. - :paramtype data_store: ~azure.mgmt.dataprotection.models.DataStoreInfoBase - """ - super().__init__(**kwargs) - self.copy_after = copy_after - self.data_store = data_store - - -class TargetDetails(_serialization.Model): - """Class encapsulating target details, used where the destination is not a datasource. - - All required parameters must be populated in order to send to server. - - :ivar file_prefix: Restore operation may create multiple files inside location pointed by Url - Below will be the common prefix for all of them. Required. - :vartype file_prefix: str - :ivar restore_target_location_type: Denotes the target location where the data will be - restored, - string value for the enum - {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. - Required. Known values are: "Invalid", "AzureBlobs", and "AzureFiles". - :vartype restore_target_location_type: str or - ~azure.mgmt.dataprotection.models.RestoreTargetLocationType - :ivar url: Url denoting the restore destination. It can point to container / file share etc. - Required. - :vartype url: str - :ivar target_resource_arm_id: Full ARM Id denoting the restore destination. It is the ARM Id - pointing to container / file share - This is optional if the target subscription can be identified with the URL field. If not - then this is needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled - states. - :vartype target_resource_arm_id: str - """ - - _validation = { - "file_prefix": {"required": True}, - "restore_target_location_type": {"required": True}, - "url": {"required": True}, - } - - _attribute_map = { - "file_prefix": {"key": "filePrefix", "type": "str"}, - "restore_target_location_type": {"key": "restoreTargetLocationType", "type": "str"}, - "url": {"key": "url", "type": "str"}, - "target_resource_arm_id": {"key": "targetResourceArmId", "type": "str"}, - } - - def __init__( - self, - *, - file_prefix: str, - restore_target_location_type: Union[str, "_models.RestoreTargetLocationType"], - url: str, - target_resource_arm_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword file_prefix: Restore operation may create multiple files inside location pointed by - Url - Below will be the common prefix for all of them. Required. - :paramtype file_prefix: str - :keyword restore_target_location_type: Denotes the target location where the data will be - restored, - string value for the enum - {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. - Required. Known values are: "Invalid", "AzureBlobs", and "AzureFiles". - :paramtype restore_target_location_type: str or - ~azure.mgmt.dataprotection.models.RestoreTargetLocationType - :keyword url: Url denoting the restore destination. It can point to container / file share etc. - Required. - :paramtype url: str - :keyword target_resource_arm_id: Full ARM Id denoting the restore destination. It is the ARM Id - pointing to container / file share - This is optional if the target subscription can be identified with the URL field. If not - then this is needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled - states. - :paramtype target_resource_arm_id: str - """ - super().__init__(**kwargs) - self.file_prefix = file_prefix - self.restore_target_location_type = restore_target_location_type - self.url = url - self.target_resource_arm_id = target_resource_arm_id - - -class TriggerBackupRequest(_serialization.Model): - """Trigger backup request. - - All required parameters must be populated in order to send to server. - - :ivar backup_rule_options: Name for the Rule of the Policy which needs to be applied for this - backup. Required. - :vartype backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions - """ - - _validation = { - "backup_rule_options": {"required": True}, - } - - _attribute_map = { - "backup_rule_options": {"key": "backupRuleOptions", "type": "AdHocBackupRuleOptions"}, - } - - def __init__(self, *, backup_rule_options: "_models.AdHocBackupRuleOptions", **kwargs: Any) -> None: - """ - :keyword backup_rule_options: Name for the Rule of the Policy which needs to be applied for - this backup. Required. - :paramtype backup_rule_options: ~azure.mgmt.dataprotection.models.AdHocBackupRuleOptions - """ - super().__init__(**kwargs) - self.backup_rule_options = backup_rule_options - - -class UnlockDeleteRequest(_serialization.Model): - """Request body of unlock delete API. - - :ivar resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check will - be performed. - :vartype resource_guard_operation_requests: list[str] - :ivar resource_to_be_deleted: - :vartype resource_to_be_deleted: str - """ - - _attribute_map = { - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "resource_to_be_deleted": {"key": "resourceToBeDeleted", "type": "str"}, - } - - def __init__( - self, - *, - resource_guard_operation_requests: Optional[List[str]] = None, - resource_to_be_deleted: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_guard_operation_requests: ResourceGuardOperationRequests on which LAC check - will be performed. - :paramtype resource_guard_operation_requests: list[str] - :keyword resource_to_be_deleted: - :paramtype resource_to_be_deleted: str - """ - super().__init__(**kwargs) - self.resource_guard_operation_requests = resource_guard_operation_requests - self.resource_to_be_deleted = resource_to_be_deleted - - -class UnlockDeleteResponse(_serialization.Model): - """Response of Unlock Delete API. - - :ivar unlock_delete_expiry_time: This is the time when unlock delete privileges will get - expired. - :vartype unlock_delete_expiry_time: str - """ - - _attribute_map = { - "unlock_delete_expiry_time": {"key": "unlockDeleteExpiryTime", "type": "str"}, - } - - def __init__(self, *, unlock_delete_expiry_time: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword unlock_delete_expiry_time: This is the time when unlock delete privileges will get - expired. - :paramtype unlock_delete_expiry_time: str - """ - super().__init__(**kwargs) - self.unlock_delete_expiry_time = unlock_delete_expiry_time - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class UserFacingError(_serialization.Model): - """Error object used by layers that have access to localized content, and propagate that to user. - - :ivar code: Unique code for this error. - :vartype code: str - :ivar details: Additional related Errors. - :vartype details: list[~azure.mgmt.dataprotection.models.UserFacingError] - :ivar inner_error: Inner Error. - :vartype inner_error: ~azure.mgmt.dataprotection.models.InnerError - :ivar is_retryable: Whether the operation will be retryable or not. - :vartype is_retryable: bool - :ivar is_user_error: Whether the operation is due to a user error or service error. - :vartype is_user_error: bool - :ivar properties: Any key value pairs that can be injected inside error object. - :vartype properties: dict[str, str] - :ivar message: - :vartype message: str - :ivar recommended_action: RecommendedAction � localized. - :vartype recommended_action: list[str] - :ivar target: Target of the error. - :vartype target: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "details": {"key": "details", "type": "[UserFacingError]"}, - "inner_error": {"key": "innerError", "type": "InnerError"}, - "is_retryable": {"key": "isRetryable", "type": "bool"}, - "is_user_error": {"key": "isUserError", "type": "bool"}, - "properties": {"key": "properties", "type": "{str}"}, - "message": {"key": "message", "type": "str"}, - "recommended_action": {"key": "recommendedAction", "type": "[str]"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - details: Optional[List["_models.UserFacingError"]] = None, - inner_error: Optional["_models.InnerError"] = None, - is_retryable: Optional[bool] = None, - is_user_error: Optional[bool] = None, - properties: Optional[Dict[str, str]] = None, - message: Optional[str] = None, - recommended_action: Optional[List[str]] = None, - target: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Unique code for this error. - :paramtype code: str - :keyword details: Additional related Errors. - :paramtype details: list[~azure.mgmt.dataprotection.models.UserFacingError] - :keyword inner_error: Inner Error. - :paramtype inner_error: ~azure.mgmt.dataprotection.models.InnerError - :keyword is_retryable: Whether the operation will be retryable or not. - :paramtype is_retryable: bool - :keyword is_user_error: Whether the operation is due to a user error or service error. - :paramtype is_user_error: bool - :keyword properties: Any key value pairs that can be injected inside error object. - :paramtype properties: dict[str, str] - :keyword message: - :paramtype message: str - :keyword recommended_action: RecommendedAction � localized. - :paramtype recommended_action: list[str] - :keyword target: Target of the error. - :paramtype target: str - """ - super().__init__(**kwargs) - self.code = code - self.details = details - self.inner_error = inner_error - self.is_retryable = is_retryable - self.is_user_error = is_user_error - self.properties = properties - self.message = message - self.recommended_action = recommended_action - self.target = target - - -class UserFacingWarningDetail(_serialization.Model): - """Warning object used by layers that have access to localized content, and propagate that to - user. - - All required parameters must be populated in order to send to server. - - :ivar resource_name: Name of resource for which warning is raised. - :vartype resource_name: str - :ivar warning: Error details for the warning. Required. - :vartype warning: ~azure.mgmt.dataprotection.models.UserFacingError - """ - - _validation = { - "warning": {"required": True}, - } - - _attribute_map = { - "resource_name": {"key": "resourceName", "type": "str"}, - "warning": {"key": "warning", "type": "UserFacingError"}, - } - - def __init__( - self, *, warning: "_models.UserFacingError", resource_name: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword resource_name: Name of resource for which warning is raised. - :paramtype resource_name: str - :keyword warning: Error details for the warning. Required. - :paramtype warning: ~azure.mgmt.dataprotection.models.UserFacingError - """ - super().__init__(**kwargs) - self.resource_name = resource_name - self.warning = warning - - -class ValidateCrossRegionRestoreRequestObject(_serialization.Model): - """Cross Region Restore Request Object. - - All required parameters must be populated in order to send to server. - - :ivar restore_request_object: Gets or sets the restore request object. Required. - :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - :ivar cross_region_restore_details: Cross region restore details. Required. - :vartype cross_region_restore_details: - ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails - """ - - _validation = { - "restore_request_object": {"required": True}, - "cross_region_restore_details": {"required": True}, - } - - _attribute_map = { - "restore_request_object": {"key": "restoreRequestObject", "type": "AzureBackupRestoreRequest"}, - "cross_region_restore_details": {"key": "crossRegionRestoreDetails", "type": "CrossRegionRestoreDetails"}, - } - - def __init__( - self, - *, - restore_request_object: "_models.AzureBackupRestoreRequest", - cross_region_restore_details: "_models.CrossRegionRestoreDetails", - **kwargs: Any - ) -> None: - """ - :keyword restore_request_object: Gets or sets the restore request object. Required. - :paramtype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - :keyword cross_region_restore_details: Cross region restore details. Required. - :paramtype cross_region_restore_details: - ~azure.mgmt.dataprotection.models.CrossRegionRestoreDetails - """ - super().__init__(**kwargs) - self.restore_request_object = restore_request_object - self.cross_region_restore_details = cross_region_restore_details - - -class ValidateForBackupRequest(_serialization.Model): - """Validate for backup request. - - All required parameters must be populated in order to send to server. - - :ivar backup_instance: Backup Instance. Required. - :vartype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance - """ - - _validation = { - "backup_instance": {"required": True}, - } - - _attribute_map = { - "backup_instance": {"key": "backupInstance", "type": "BackupInstance"}, - } - - def __init__(self, *, backup_instance: "_models.BackupInstance", **kwargs: Any) -> None: - """ - :keyword backup_instance: Backup Instance. Required. - :paramtype backup_instance: ~azure.mgmt.dataprotection.models.BackupInstance - """ - super().__init__(**kwargs) - self.backup_instance = backup_instance - - -class ValidateRestoreRequestObject(_serialization.Model): - """Validate restore request object. - - All required parameters must be populated in order to send to server. - - :ivar restore_request_object: Gets or sets the restore request object. Required. - :vartype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - """ - - _validation = { - "restore_request_object": {"required": True}, - } - - _attribute_map = { - "restore_request_object": {"key": "restoreRequestObject", "type": "AzureBackupRestoreRequest"}, - } - - def __init__(self, *, restore_request_object: "_models.AzureBackupRestoreRequest", **kwargs: Any) -> None: - """ - :keyword restore_request_object: Gets or sets the restore request object. Required. - :paramtype restore_request_object: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - """ - super().__init__(**kwargs) - self.restore_request_object = restore_request_object diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py index 42904f5f3feb..f58feb19c84b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py @@ -2,60 +2,66 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._backup_vaults_operations import BackupVaultsOperations -from ._operation_result_operations import OperationResultOperations -from ._operation_status_operations import OperationStatusOperations -from ._operation_status_backup_vault_context_operations import OperationStatusBackupVaultContextOperations -from ._operation_status_resource_group_context_operations import OperationStatusResourceGroupContextOperations -from ._backup_vault_operation_results_operations import BackupVaultOperationResultsOperations -from ._data_protection_operations import DataProtectionOperations -from ._data_protection_operations_operations import DataProtectionOperationsOperations -from ._backup_policies_operations import BackupPoliciesOperations -from ._backup_instances_operations import BackupInstancesOperations -from ._recovery_points_operations import RecoveryPointsOperations -from ._fetch_secondary_recovery_points_operations import FetchSecondaryRecoveryPointsOperations -from ._fetch_cross_region_restore_job_operations import FetchCrossRegionRestoreJobOperations -from ._fetch_cross_region_restore_jobs_operations import FetchCrossRegionRestoreJobsOperations -from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations -from ._jobs_operations import JobsOperations -from ._restorable_time_ranges_operations import RestorableTimeRangesOperations -from ._export_jobs_operations import ExportJobsOperations -from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations -from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations -from ._resource_guards_operations import ResourceGuardsOperations -from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import DataProtectionOperationsOperations # type: ignore +from ._operations import BackupInstancesOperations # type: ignore +from ._operations import BackupVaultOperationResultsOperations # type: ignore +from ._operations import ResourceGuardsOperations # type: ignore +from ._operations import BackupVaultsOperations # type: ignore +from ._operations import OperationStatusBackupVaultContextOperations # type: ignore +from ._operations import ExportJobsOperations # type: ignore +from ._operations import ExportJobsOperationResultOperations # type: ignore +from ._operations import BackupPoliciesOperations # type: ignore +from ._operations import RestorableTimeRangesOperations # type: ignore +from ._operations import RecoveryPointsOperations # type: ignore +from ._operations import JobsOperations # type: ignore +from ._operations import DeletedBackupInstancesOperations # type: ignore +from ._operations import DppResourceGuardProxyOperations # type: ignore +from ._operations import OperationResultOperations # type: ignore +from ._operations import OperationStatusOperations # type: ignore +from ._operations import OperationStatusResourceGroupContextOperations # type: ignore +from ._operations import DataProtectionOperations # type: ignore +from ._operations import FetchSecondaryRecoveryPointsOperations # type: ignore +from ._operations import FetchCrossRegionRestoreJobOperations # type: ignore +from ._operations import FetchCrossRegionRestoreJobsOperations # type: ignore +from ._operations import BackupInstancesExtensionRoutingOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "DataProtectionOperationsOperations", + "BackupInstancesOperations", + "BackupVaultOperationResultsOperations", + "ResourceGuardsOperations", "BackupVaultsOperations", + "OperationStatusBackupVaultContextOperations", + "ExportJobsOperations", + "ExportJobsOperationResultOperations", + "BackupPoliciesOperations", + "RestorableTimeRangesOperations", + "RecoveryPointsOperations", + "JobsOperations", + "DeletedBackupInstancesOperations", + "DppResourceGuardProxyOperations", "OperationResultOperations", "OperationStatusOperations", - "OperationStatusBackupVaultContextOperations", "OperationStatusResourceGroupContextOperations", - "BackupVaultOperationResultsOperations", "DataProtectionOperations", - "DataProtectionOperationsOperations", - "BackupPoliciesOperations", - "BackupInstancesOperations", - "RecoveryPointsOperations", "FetchSecondaryRecoveryPointsOperations", "FetchCrossRegionRestoreJobOperations", "FetchCrossRegionRestoreJobsOperations", "BackupInstancesExtensionRoutingOperations", - "JobsOperations", - "RestorableTimeRangesOperations", - "ExportJobsOperations", - "ExportJobsOperationResultOperations", - "DeletedBackupInstancesOperations", - "ResourceGuardsOperations", - "DppResourceGuardProxyOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py deleted file mode 100644 index 14b3647df5c9..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py +++ /dev/null @@ -1,165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, 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 _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceId}/providers/Microsoft.DataProtection/backupInstances") - path_format_arguments = { - "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BackupInstancesExtensionRoutingOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`backup_instances_extension_routing` 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_id: str, **kwargs: Any) -> Iterable["_models.BackupInstanceResource"]: - """Gets a list of backup instances associated with a tracked resource. - - :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. - Required. - :type resource_id: str - :return: An iterator like instance of either BackupInstanceResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_id=resource_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py deleted file mode 100644 index 1f6a952487cf..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py +++ /dev/null @@ -1,3583 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_adhoc_backup_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_for_backup_request( - resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_backup_instance_operation_result_request( # pylint: disable=name-too-long - resource_group_name: str, - vault_name: str, - backup_instance_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_trigger_cross_region_restore_request( # pylint: disable=name-too-long - resource_group_name: str, location: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_cross_region_restore_request( # pylint: disable=name-too-long - resource_group_name: str, location: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_trigger_rehydrate_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_trigger_restore_request( - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_resume_backups_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_resume_protection_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_protection_request( - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_suspend_backups_request( - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_sync_backup_instance_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_for_restore_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BackupInstancesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`backup_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.BackupInstanceResource"]: - """Gets a backup instances belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either BackupInstanceResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> _models.BackupInstanceResource: - """Gets a backup instance with name in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :return: BackupInstanceResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.BackupInstanceResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> Optional[_models.BackupInstanceResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupInstanceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.BackupInstanceResource, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInstanceResource]: - """Create or update a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BackupInstanceResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInstanceResource]: - """Create or update a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BackupInstanceResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.BackupInstanceResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.BackupInstanceResource]: - """Create or update a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a BackupInstanceResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of LROPoller that returns either BackupInstanceResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BackupInstanceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BackupInstanceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a backup instance in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _adhoc_backup_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.TriggerBackupRequest, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "TriggerBackupRequest") - - _request = build_adhoc_backup_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_adhoc_backup( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.TriggerBackupRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Trigger adhoc backup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_adhoc_backup( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Trigger adhoc backup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_adhoc_backup( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.TriggerBackupRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Trigger adhoc backup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a TriggerBackupRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest or IO[bytes] - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._adhoc_backup_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_for_backup_initial( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.ValidateForBackupRequest, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ValidateForBackupRequest") - - _request = build_validate_for_backup_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_for_backup( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.ValidateForBackupRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validate whether adhoc backup will be successful or not. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_for_backup( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validate whether adhoc backup will be successful or not. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_for_backup( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.ValidateForBackupRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validate whether adhoc backup will be successful or not. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Is either a ValidateForBackupRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest or IO[bytes] - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_for_backup_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_backup_instance_operation_result( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.BackupInstanceResource]: - """Get result of backup instance creation operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param operation_id: Required. - :type operation_id: str - :return: BackupInstanceResource or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) - - _request = build_get_backup_instance_operation_result_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("BackupInstanceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _trigger_cross_region_restore_initial( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CrossRegionRestoreRequestObject") - - _request = build_trigger_cross_region_restore_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_trigger_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: _models.CrossRegionRestoreRequestObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Triggers Cross Region Restore for BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for trigger CRR operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_trigger_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Triggers Cross Region Restore for BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for trigger CRR operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_trigger_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Triggers Cross Region Restore for BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for trigger CRR operation. Is either a - CrossRegionRestoreRequestObject type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject or - IO[bytes] - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._trigger_cross_region_restore_initial( - resource_group_name=resource_group_name, - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _validate_cross_region_restore_initial( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ValidateCrossRegionRestoreRequestObject") - - _request = build_validate_cross_region_restore_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: _models.ValidateCrossRegionRestoreRequestObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validates whether Cross Region Restore can be triggered for DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validates whether Cross Region Restore can be triggered for DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_cross_region_restore( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validates whether Cross Region Restore can be triggered for DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a - ValidateCrossRegionRestoreRequestObject type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject or - IO[bytes] - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_cross_region_restore_initial( - resource_group_name=resource_group_name, - location=location, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRehydrationRequest, IO[bytes]], - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AzureBackupRehydrationRequest") - - _request = build_trigger_rehydrate_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - def begin_trigger_rehydrate( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.AzureBackupRehydrationRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """rehydrate recovery point for restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_rehydrate( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """rehydrate recovery point for restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_rehydrate( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRehydrationRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """rehydrate recovery point for restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a AzureBackupRehydrationRequest type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._trigger_rehydrate_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _trigger_restore_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRestoreRequest, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AzureBackupRestoreRequest") - - _request = build_trigger_restore_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_trigger_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.AzureBackupRestoreRequest, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Triggers restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_trigger_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Triggers restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_trigger_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupRestoreRequest, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Triggers restore for a BackupInstance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a AzureBackupRestoreRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._trigger_restore_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _resume_backups_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_resume_backups_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_resume_backups( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """This operation will resume backups for backup instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._resume_backups_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _resume_protection_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_resume_protection_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_resume_protection( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """This operation will resume protection for a stopped backup instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._resume_protection_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_protection_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.StopProtectionRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "StopProtectionRequest") - else: - _json = None - - _request = build_stop_protection_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - def begin_stop_protection( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[_models.StopProtectionRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """This operation will stop protection of a backup instance and data will be held forever. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_stop_protection( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """This operation will stop protection of a backup instance and data will be held forever. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_stop_protection( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.StopProtectionRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """This operation will stop protection of a backup instance and data will be held forever. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Is either a StopProtectionRequest type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_protection_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.SuspendBackupRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "SuspendBackupRequest") - else: - _json = None - - _request = build_suspend_backups_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - def begin_suspend_backups( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[_models.SuspendBackupRequest] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """This operation will stop backup for a backup instance and retains the backup data as per the - policy (except latest Recovery point, which will be retained forever). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_suspend_backups( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """This operation will stop backup for a backup instance and retains the backup data as per the - policy (except latest Recovery point, which will be retained forever). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_suspend_backups( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - x_ms_authorization_auxiliary: Optional[str] = None, - parameters: Optional[Union[_models.SuspendBackupRequest, IO[bytes]]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """This operation will stop backup for a backup instance and retains the backup data as per the - policy (except latest Recovery point, which will be retained forever). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :param parameters: Request body for operation. Is either a SuspendBackupRequest type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._suspend_backups_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.SyncBackupInstanceRequest, IO[bytes]], - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SyncBackupInstanceRequest") - - _request = build_sync_backup_instance_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @overload - def begin_sync_backup_instance( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.SyncBackupInstanceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Sync backup instance again in case of failure - This action will retry last failed operation and will bring backup instance to valid state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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_sync_backup_instance( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Sync backup instance again in case of failure - This action will retry last failed operation and will bring backup instance to valid state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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_sync_backup_instance( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.SyncBackupInstanceRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Sync backup instance again in case of failure - This action will retry last failed operation and will bring backup instance to valid state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a SyncBackupInstanceRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest or IO[bytes] - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._sync_backup_instance_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _validate_for_restore_initial( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.ValidateRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.OperationJobExtendedInfo]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ValidateRestoreRequestObject") - - _request = build_validate_for_restore_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_for_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.ValidateRestoreRequestObject, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validates if Restore can be triggered for a DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_for_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validates if Restore can be triggered for a DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_for_restore( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.ValidateRestoreRequestObject, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.OperationJobExtendedInfo]: - """Validates if Restore can be triggered for a DataSource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a ValidateRestoreRequestObject type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject or IO[bytes] - :return: An instance of LROPoller that returns either OperationJobExtendedInfo or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._validate_for_restore_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.OperationJobExtendedInfo]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py deleted file mode 100644 index 5141ece71cca..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py +++ /dev/null @@ -1,554 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, backup_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, vault_name: str, backup_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vault_name: str, backup_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class BackupPoliciesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`backup_policies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.BaseBackupPolicyResource"]: - """Returns list of backup policies belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either BaseBackupPolicyResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BaseBackupPolicyResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Gets a backup policy belonging to a backup vault. - - Gets a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Required. - :type backup_policy_name: str - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_policy_name=backup_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_policy_name: str, - parameters: _models.BaseBackupPolicyResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Creates or Updates a backup policy belonging to a backup vault. - - Creates or Updates a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Name of the policy. Required. - :type backup_policy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_policy_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Creates or Updates a backup policy belonging to a backup vault. - - Creates or Updates a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Name of the policy. Required. - :type backup_policy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - backup_policy_name: str, - parameters: Union[_models.BaseBackupPolicyResource, IO[bytes]], - **kwargs: Any - ) -> _models.BaseBackupPolicyResource: - """Creates or Updates a backup policy belonging to a backup vault. - - Creates or Updates a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Name of the policy. Required. - :type backup_policy_name: str - :param parameters: Request body for operation. Is either a BaseBackupPolicyResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource or IO[bytes] - :return: BaseBackupPolicyResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BaseBackupPolicyResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_policy_name=backup_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BaseBackupPolicyResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any - ) -> None: - """Deletes a backup policy belonging to a backup vault. - - Deletes a backup policy belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_policy_name: Required. - :type backup_policy_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_policy_name=backup_policy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py deleted file mode 100644 index c8bc2ca2e2e8..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py +++ /dev/null @@ -1,164 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BackupVaultOperationResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`backup_vault_operation_results` 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 get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.BackupVaultResource]: - """get. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param operation_id: Required. - :type operation_id: str - :return: BackupVaultResource or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py deleted file mode 100644 index e8f0a8b9bf40..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py +++ /dev/null @@ -1,1156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_in_resource_group_request(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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - vault_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - vault_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - 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, **kwargs) - - -def build_check_name_availability_request( - resource_group_name: str, location: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BackupVaultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`backup_vaults` 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 get_in_subscription(self, **kwargs: Any) -> Iterable["_models.BackupVaultResource"]: - """Returns resource collection belonging to a subscription. - - :return: An iterator like instance of either BackupVaultResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_in_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_in_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BackupVaultResource"]: - """Returns resource collection belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either BackupVaultResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_in_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BackupVaultResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.BackupVaultResource: - """Returns a resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: BackupVaultResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.BackupVaultResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> _models.BackupVaultResource: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BackupVaultResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.BackupVaultResource, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupVaultResource]: - """Creates or updates a BackupVault resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupVaultResource]: - """Creates or updates a BackupVault resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.BackupVaultResource, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.BackupVaultResource]: - """Creates or updates a BackupVault resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Is either a BackupVaultResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of LROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BackupVaultResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BackupVaultResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a BackupVault resource from the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _update_initial( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.PatchResourceRequestInput, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> Optional[_models.BackupVaultResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PatchResourceRequestInput") - - _request = build_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.PatchResourceRequestInput, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupVaultResource]: - """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupVaultResource]: - """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.PatchResourceRequestInput, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.BackupVaultResource]: - """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a - resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param parameters: Request body for operation. Is either a PatchResourceRequestInput type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: An instance of LROPoller that returns either BackupVaultResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BackupVaultResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BackupVaultResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BackupVaultResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def check_name_availability( - self, - resource_group_name: str, - location: str, - parameters: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """API to check for resource name availability. - - API to check for resource name availability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param parameters: Check name availability request. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """API to check for resource name availability. - - API to check for resource name availability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param parameters: Check name availability request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], - **kwargs: Any - ) -> _models.CheckNameAvailabilityResult: - """API to check for resource name availability. - - API to check for resource name availability. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The location in which uniqueness will be verified. Required. - :type location: str - :param parameters: Check name availability request. Is either a CheckNameAvailabilityRequest - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest or IO[bytes] - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") - - _request = build_check_name_availability_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py deleted file mode 100644 index 301cd0a52ac5..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, 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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_check_feature_support_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DataProtectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`data_protection` 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") - - @overload - def check_feature_support( - self, - location: str, - parameters: _models.FeatureValidationRequestBase, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FeatureValidationResponseBase: - """Validates if a feature is supported. - - Validates if a feature is supported. - - :param location: Required. - :type location: str - :param parameters: Feature support request object. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FeatureValidationResponseBase or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_feature_support( - self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.FeatureValidationResponseBase: - """Validates if a feature is supported. - - Validates if a feature is supported. - - :param location: Required. - :type location: str - :param parameters: Feature support request object. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: FeatureValidationResponseBase or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_feature_support( - self, location: str, parameters: Union[_models.FeatureValidationRequestBase, IO[bytes]], **kwargs: Any - ) -> _models.FeatureValidationResponseBase: - """Validates if a feature is supported. - - Validates if a feature is supported. - - :param location: Required. - :type location: str - :param parameters: Feature support request object. Is either a FeatureValidationRequestBase - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase or IO[bytes] - :return: FeatureValidationResponseBase or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FeatureValidationResponseBase] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FeatureValidationRequestBase") - - _request = build_check_feature_support_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FeatureValidationResponseBase", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py deleted file mode 100644 index 7c4061c585db..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, 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 _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.DataProtection/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DataProtectionOperationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`data_protection_operations` 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, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingleApi"]: - """Returns the list of available operations. - - :return: An iterator like instance of either ClientDiscoveryValueForSingleApi or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ClientDiscoveryValueForSingleApi] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py deleted file mode 100644 index f0fa3634eb25..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py +++ /dev/null @@ -1,410 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast -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.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_undelete_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DeletedBackupInstancesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`deleted_backup_instances` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.DeletedBackupInstanceResource"]: - """Gets deleted backup instances belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either DeletedBackupInstanceResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedBackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> _models.DeletedBackupInstanceResource: - """Gets a deleted backup instance with name in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the deleted backup instance. Required. - :type backup_instance_name: str - :return: DeletedBackupInstanceResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedBackupInstanceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _undelete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_undelete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def begin_undelete( - self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any - ) -> LROPoller[None]: - """undelete. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the deleted backup instance. Required. - :type backup_instance_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._undelete_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py deleted file mode 100644 index 96eefbc265d5..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py +++ /dev/null @@ -1,770 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url( - "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url( - "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url( - "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_unlock_delete_request( - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - subscription_id: str, - *, - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url( - "resource_guard_proxy_name", resource_guard_proxy_name, "str", pattern=r"^[A-Za-z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if x_ms_authorization_auxiliary is not None: - _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( - "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" - ) - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DppResourceGuardProxyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`dpp_resource_guard_proxy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.ResourceGuardProxyBaseResource"]: - """Returns the list of ResourceGuardProxies associated with the vault. - - Returns the list of ResourceGuardProxies associated with the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in - the request. - - Returns the ResourceGuardProxy object associated with the vault, and that matches the name in - the request. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.ResourceGuardProxyBaseResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Creates or Updates a ResourceGuardProxy. - - Creates or Updates a ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Creates or Updates a ResourceGuardProxy. - - Creates or Updates a ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.ResourceGuardProxyBaseResource, IO[bytes]], - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """Creates or Updates a ResourceGuardProxy. - - Creates or Updates a ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a ResourceGuardProxyBaseResource type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO[bytes] - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> None: - """Deletes the ResourceGuardProxy. - - Deletes the ResourceGuardProxy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.UnlockDeleteRequest, - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO[bytes], - x_ms_authorization_auxiliary: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.UnlockDeleteRequest, IO[bytes]], - x_ms_authorization_auxiliary: Optional[str] = None, - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - UnlockDelete call for ResourceGuardProxy, executed before one can delete it. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: name of the resource guard proxy. Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a UnlockDeleteRequest type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO[bytes] - :param x_ms_authorization_auxiliary: Default value is None. - :type x_ms_authorization_auxiliary: str - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "UnlockDeleteRequest") - - _request = build_unlock_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py deleted file mode 100644 index 1b6de80ef037..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py +++ /dev/null @@ -1,158 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ExportJobsOperationResultOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`export_jobs_operation_result` 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 get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> Optional[_models.ExportJobsResult]: - """Gets the operation result of operation triggered by Export Jobs API. If the operation is - successful, then it also contains URL of a Blob and a SAS key to access the same. The blob - contains exported jobs in JSON serialized format. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param operation_id: OperationID which represents the export job. Required. - :type operation_id: str - :return: ExportJobsResult or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("ExportJobsResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py deleted file mode 100644 index 8c2feeb4ad45..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast - -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 -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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( - resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ExportJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`export_jobs` 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") - - def _trigger_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_trigger_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: - """Triggers export of jobs and returns an OperationID to track. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :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 = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._trigger_initial( # type: ignore - resource_group_name=resource_group_name, - vault_name=vault_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py deleted file mode 100644 index 9bddc23fd1ed..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_job_operations.py +++ /dev/null @@ -1,225 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, 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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJob", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FetchCrossRegionRestoreJobOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`fetch_cross_region_restore_job` 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") - - @overload - def get( - self, - resource_group_name: str, - location: str, - parameters: _models.CrossRegionRestoreJobRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Fetches the Cross Region Restore Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Fetches the Cross Region Restore Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def get( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreJobRequest, IO[bytes]], - **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Fetches the Cross Region Restore Job. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a CrossRegionRestoreJobRequest type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest or IO[bytes] - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CrossRegionRestoreJobRequest") - - _request = build_get_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupJobResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_jobs_operations.py deleted file mode 100644 index 6f8b3bb2a29b..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_cross_region_restore_jobs_operations.py +++ /dev/null @@ -1,270 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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, location: 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJobs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # 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 - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FetchCrossRegionRestoreJobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`fetch_cross_region_restore_jobs` 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") - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: _models.CrossRegionRestoreJobsRequest, - filter: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterable["_models.AzureBackupJobResource"]: - """Fetches list of Cross Region Restore job belonging to the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest - :param filter: OData filter options. Default value is None. - :type filter: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - filter: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterable["_models.AzureBackupJobResource"]: - """Fetches list of Cross Region Restore job belonging to the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :param filter: OData filter options. Default value is None. - :type filter: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def list( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.CrossRegionRestoreJobsRequest, IO[bytes]], - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.AzureBackupJobResource"]: - """Fetches list of Cross Region Restore job belonging to the vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a CrossRegionRestoreJobsRequest type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest or IO[bytes] - :param filter: OData filter options. Default value is None. - :type filter: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CrossRegionRestoreJobsRequest") - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_recovery_points_operations.py deleted file mode 100644 index 6778813c4e59..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_fetch_secondary_recovery_points_operations.py +++ /dev/null @@ -1,295 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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, - location: str, - subscription_id: str, - *, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchSecondaryRecoveryPoints", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "location": _SERIALIZER.url("location", location, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip_token is not None: - _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, **kwargs) - - -class FetchSecondaryRecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`fetch_secondary_recovery_points` 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") - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: _models.FetchSecondaryRPsRequestParameters, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for - Cross Region Restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters - :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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def list( - self, - resource_group_name: str, - location: str, - parameters: IO[bytes], - filter: Optional[str] = None, - skip_token: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for - Cross Region Restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def list( - self, - resource_group_name: str, - location: str, - parameters: Union[_models.FetchSecondaryRPsRequestParameters, IO[bytes]], - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for - Cross Region Restore. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param location: The name of the Azure region. Required. - :type location: str - :param parameters: Request body for operation. Is either a FetchSecondaryRPsRequestParameters - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters or - IO[bytes] - :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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FetchSecondaryRPsRequestParameters") - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - location=location, - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py deleted file mode 100644 index 111ce0426601..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py +++ /dev/null @@ -1,274 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, 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 _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, job_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "jobId": _SERIALIZER.url("job_id", job_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class JobsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`jobs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.AzureBackupJobResource"]: - """Returns list of jobs belonging to a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :return: An iterator like instance of either AzureBackupJobResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupJobResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any - ) -> _models.AzureBackupJobResource: - """Gets a job with id in a backup vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param job_id: The Job ID. This is a GUID-formatted string (e.g. - 00000000-0000-0000-0000-000000000000). Required. - :type job_id: str - :return: AzureBackupJobResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - job_id=job_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupJobResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py deleted file mode 100644 index 4e3a69cc6332..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(operation_id: str, location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class OperationResultOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`operation_result` 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 get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_models.OperationJobExtendedInfo]: - """Gets the operation status for a resource. - - Gets the operation result for a resource. - - :param operation_id: Required. - :type operation_id: str - :param location: Required. - :type location: str - :return: OperationJobExtendedInfo or None or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) - - _request = build_get_request( - operation_id=operation_id, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OperationJobExtendedInfo", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py deleted file mode 100644 index 1e9463a7c217..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class OperationStatusBackupVaultContextOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`operation_status_backup_vault_context` 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 get( - self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any - ) -> _models.OperationResource: - """Gets the operation status for an operation over a BackupVault's context. - - Gets the operation status for an operation over a BackupVault's context. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param operation_id: Required. - :type operation_id: str - :return: OperationResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py deleted file mode 100644 index 4333b1e72830..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py +++ /dev/null @@ -1,145 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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(location: 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`operation_status` 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 get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: - """Gets the operation status for a resource. - - Gets the operation status for a resource. - - :param location: Required. - :type location: str - :param operation_id: Required. - :type operation_id: str - :return: OperationResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py deleted file mode 100644 index c2c577d3b0bf..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py +++ /dev/null @@ -1,148 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar - -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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class OperationStatusResourceGroupContextOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`operation_status_resource_group_context` 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 get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: - """Gets the operation status for an operation over a ResourceGroup's context. - - Gets the operation status for an operation over a ResourceGroup's context. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param operation_id: Required. - :type operation_id: str - :return: OperationResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.OperationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operations.py new file mode 100644 index 000000000000..002866dabe2c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operations.py @@ -0,0 +1,12208 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import DataProtectionClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_data_protection_operations_list_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.DataProtection/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_get_backup_instance_operation_result_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + backup_instance_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_list_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_validate_for_backup_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_get_request( + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_delete_request( + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_adhoc_backup_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_validate_for_modify_backup_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateForModifyBackup" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_trigger_rehydrate_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_trigger_restore_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_resume_backups_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_backup_instances_resume_protection_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_backup_instances_stop_protection_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_suspend_backups_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_sync_backup_instance_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_validate_for_restore_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_trigger_cross_region_restore_request( # pylint: disable=name-too-long + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_validate_cross_region_restore_request( # pylint: disable=name-too-long + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_vault_operation_results_get_request( # pylint: disable=name-too-long + resource_group_name: str, vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_default_delete_resource_guard_proxy_requests_object_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + "requestName": _SERIALIZER.url("request_name", request_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_delete_resource_guard_proxy_requests_objects_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_request( + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_put_request( + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_patch_request( + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_delete_request( + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_resource_guards_get_resources_in_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_resources_in_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_default_disable_soft_delete_requests_object_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + "requestName": _SERIALIZER.url("request_name", request_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_disable_soft_delete_requests_objects_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_default_update_protected_item_requests_object_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + "requestName": _SERIALIZER.url("request_name", request_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_update_protected_item_requests_objects_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_default_update_protection_policy_requests_object_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + "requestName": _SERIALIZER.url("request_name", request_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_update_protection_policy_requests_objects_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_default_delete_protected_item_requests_object_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + "requestName": _SERIALIZER.url("request_name", request_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_delete_protected_item_requests_objects_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_default_backup_security_pin_requests_object_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + "requestName": _SERIALIZER.url("request_name", request_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_guards_get_backup_security_pin_requests_objects_request( # pylint: disable=name-too-long + resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_vaults_get_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_vaults_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_vaults_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + 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, **kwargs) + + +def build_backup_vaults_delete_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_backup_vaults_get_in_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_vaults_get_in_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_vaults_check_name_availability_request( # pylint: disable=name-too-long + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operation_status_backup_vault_context_get_request( # pylint: disable=name-too-long + resource_group_name: str, vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_jobs_trigger_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_export_jobs_operation_result_get_request( # pylint: disable=name-too-long + resource_group_name: str, vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_policies_get_request( + resource_group_name: str, vault_name: str, backup_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_policies_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_policies_delete_request( + resource_group_name: str, vault_name: str, backup_policy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_backup_policies_list_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restorable_time_ranges_find_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recovery_points_get_request( + resource_group_name: str, + vault_name: str, + backup_instance_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_recovery_points_list_request( + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_jobs_get_request( + resource_group_name: str, vault_name: str, job_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "jobId": _SERIALIZER.url("job_id", job_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_jobs_list_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deleted_backup_instances_get_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deleted_backup_instances_list_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deleted_backup_instances_undelete_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_dpp_resource_guard_proxy_get_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + 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"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dpp_resource_guard_proxy_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + 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"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dpp_resource_guard_proxy_delete_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + 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"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_dpp_resource_guard_proxy_list_request( # pylint: disable=name-too-long + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_dpp_resource_guard_proxy_unlock_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + subscription_id: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + 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"), + "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if x_ms_authorization_auxiliary is not None: + _headers["x-ms-authorization-auxiliary"] = _SERIALIZER.header( + "x_ms_authorization_auxiliary", x_ms_authorization_auxiliary, "str" + ) + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operation_result_get_request( + operation_id: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operation_status_get_request( + location: 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operation_status_resource_group_context_get_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_data_protection_check_feature_support_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fetch_secondary_recovery_points_list_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + subscription_id: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchSecondaryRecoveryPoints" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if skip_token is not None: + _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, **kwargs) + + +def build_fetch_cross_region_restore_job_get_request( # pylint: disable=name-too-long + resource_group_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJob" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_fetch_cross_region_restore_jobs_list_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJobs" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # 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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_backup_instances_extension_routing_list_request( # pylint: disable=name-too-long + resource_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/{resourceId}/providers/Microsoft.DataProtection/backupInstances" + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataProtectionOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`data_protection_operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_data_protection_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BackupInstancesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`backup_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_backup_instance_operation_result( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.BackupInstanceResource]: + """Get result of backup instance creation operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param operation_id: The name of the BackupInstanceResource. Required. + :type operation_id: str + :return: BackupInstanceResource or None. The BackupInstanceResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) + + _request = build_backup_instances_get_backup_instance_operation_result_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupInstanceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> ItemPaged["_models.BackupInstanceResource"]: + """Gets a backup instances belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of BackupInstanceResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupInstanceResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_instances_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupInstanceResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _validate_for_backup_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.ValidateForBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_for_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.ValidateForBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_for_backup( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.ValidateForBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validate whether adhoc backup will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Is one of the following types: + ValidateForBackupRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForBackupRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_for_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> _models.BackupInstanceResource: + """Gets a backup instance with name in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :return: BackupInstanceResource. The BackupInstanceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupInstanceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) + + _request = build_backup_instances_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupInstanceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.BackupInstanceResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.BackupInstanceResource, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.BackupInstanceResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.BackupInstanceResource]: + """Create or update a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + BackupInstanceResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupInstanceResource or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns BackupInstanceResource. The + BackupInstanceResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupInstanceResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BackupInstanceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BackupInstanceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_instances_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a backup instance in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _adhoc_backup_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.TriggerBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_adhoc_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.TriggerBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_adhoc_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.TriggerBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Trigger adhoc backup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + TriggerBackupRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.TriggerBackupRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._adhoc_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _validate_for_modify_backup_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_for_modify_backup_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.ValidateForModifyBackupRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_for_modify_backup( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateForModifyBackupRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Validate whether update for backup instance will be successful or not. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + ValidateForModifyBackupRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateForModifyBackupRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_for_modify_backup_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _trigger_rehydrate_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRehydrationRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_trigger_rehydrate_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.AzureBackupRehydrationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_rehydrate( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRehydrationRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """rehydrate recovery point for restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + AzureBackupRehydrationRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._trigger_rehydrate_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _trigger_restore_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRestoreRequest, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_trigger_restore_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.AzureBackupRestoreRequest, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupRestoreRequest, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers restore for a BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + AzureBackupRestoreRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRestoreRequest or JSON or + IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._trigger_restore_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _resume_backups_initial( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_instances_resume_backups_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_resume_backups( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """This operation will resume backups for backup instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_backups_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _resume_protection_initial( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_instances_resume_protection_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_resume_protection( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """This operation will resume protection for a stopped backup instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _stop_protection_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.StopProtectionRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_backup_instances_stop_protection_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[_models.StopProtectionRequest] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[JSON] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[IO[bytes]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_protection( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.StopProtectionRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop protection of a backup instance and data will be held forever. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Is one of the following types: + StopProtectionRequest, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.StopProtectionRequest or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_protection_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _suspend_backups_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.SuspendBackupRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if parameters else None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + if parameters is not None: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_backup_instances_suspend_backups_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[_models.SuspendBackupRequest] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[JSON] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[IO[bytes]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Default value is None. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_suspend_backups( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Optional[Union[_models.SuspendBackupRequest, JSON, IO[bytes]]] = None, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """This operation will stop backup for a backup instance and retains the backup data as per the + policy (except latest Recovery point, which will be retained forever). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: The content of the action request. Is one of the following types: + SuspendBackupRequest, JSON, IO[bytes] Default value is None. + :type parameters: ~azure.mgmt.dataprotection.models.SuspendBackupRequest or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._suspend_backups_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _sync_backup_instance_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.SyncBackupInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_sync_backup_instance_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.SyncBackupInstanceRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_sync_backup_instance( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.SyncBackupInstanceRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Sync backup instance again in case of failure + This action will retry last failed operation and will bring backup instance to valid state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + SyncBackupInstanceRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._sync_backup_instance_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _validate_for_restore_initial( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_for_restore_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.ValidateRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_for_restore( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.ValidateRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates if Restore can be triggered for a DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + ValidateRestoreRequestObject, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateRestoreRequestObject or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_for_restore_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _trigger_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_trigger_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_trigger_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Triggers Cross Region Restore for BackupInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for trigger CRR operation. Is one of the following types: + CrossRegionRestoreRequestObject, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreRequestObject or JSON or + IO[bytes] + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._trigger_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _validate_cross_region_restore_initial( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_instances_validate_cross_region_restore_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: _models.ValidateCrossRegionRestoreRequestObject, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_cross_region_restore( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.ValidateCrossRegionRestoreRequestObject, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OperationJobExtendedInfo]: + """Validates whether Cross Region Restore can be triggered for DataSource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + ValidateCrossRegionRestoreRequestObject, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ValidateCrossRegionRestoreRequestObject or + JSON or IO[bytes] + :return: An instance of LROPoller that returns OperationJobExtendedInfo. The + OperationJobExtendedInfo is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.OperationJobExtendedInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.OperationJobExtendedInfo] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_cross_region_restore_initial( + resource_group_name=resource_group_name, + location=location, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationJobExtendedInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationJobExtendedInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class BackupVaultOperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`backup_vault_operation_results` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.BackupVaultResource]: + """Get a BackupVaultResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param operation_id: The name of the BackupVaultResource. Required. + :type operation_id: str + :return: BackupVaultResource or None. The BackupVaultResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) + + _request = build_backup_vault_operation_results_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class ResourceGuardsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`resource_guards` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_delete_resource_guard_proxy_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> ItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_delete_resource_guard_proxy_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any) -> _models.ResourceGuardResource: + """Returns a ResourceGuard belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: _models.ResourceGuardResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: Union[_models.ResourceGuardResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Creates or updates a ResourceGuard resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Is one of the following types: + ResourceGuardResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource or JSON or IO[bytes] + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_resource_guards_put_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: _models.PatchResourceGuardInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch( + self, + resource_group_name: str, + resource_guards_name: str, + parameters: Union[_models.PatchResourceGuardInput, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ResourceGuardResource: + """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for + a resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :param parameters: Request body for operation. Is one of the following types: + PatchResourceGuardInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput or JSON or + IO[bytes] + :return: ResourceGuardResource. The ResourceGuardResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_resource_guards_patch_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> None: + """Deletes a ResourceGuard resource from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of ResourceGuard. Required. + :type resource_guards_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resource_guards_delete_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_resources_in_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ResourceGuardResource"]: + """Returns ResourceGuards collection belonging to a ResourceGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ResourceGuardResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceGuardResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_resources_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceGuardResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_resources_in_subscription(self, **kwargs: Any) -> ItemPaged["_models.ResourceGuardResource"]: + """Returns ResourceGuards collection belonging to a subscription. + + :return: An iterator like instance of ResourceGuardResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceGuardResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_resources_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceGuardResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_disable_soft_delete_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_disable_soft_delete_requests_objects( + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> ItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_disable_soft_delete_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_update_protected_item_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_update_protected_item_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> ItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_update_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_update_protection_policy_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> ItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_update_protection_policy_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_delete_protected_item_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> ItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_delete_protected_item_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long + self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any + ) -> _models.DppBaseResource: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :param request_name: The name of the DppBaseResource. Required. + :type request_name: str + :return: DppBaseResource. The DppBaseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) + + _request = build_resource_guards_get_default_backup_security_pin_requests_object_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + request_name=request_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DppBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_backup_security_pin_requests_objects( + self, resource_group_name: str, resource_guards_name: str, **kwargs: Any + ) -> ItemPaged["_models.DppBaseResource"]: + """Returns collection of operation request objects for a critical operation protected by the given + ResourceGuard resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_guards_name: The name of the ResourceGuardResource. Required. + :type resource_guards_name: str + :return: An iterator like instance of DppBaseResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DppBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_resource_guards_get_backup_security_pin_requests_objects_request( + resource_group_name=resource_group_name, + resource_guards_name=resource_guards_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DppBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BackupVaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`backup_vaults` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.BackupVaultResource: + """Returns a resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :return: BackupVaultResource. The BackupVaultResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BackupVaultResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) + + _request = build_backup_vaults_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.BackupVaultResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_vaults_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.BackupVaultResource, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.BackupVaultResource, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Creates or updates a BackupVault resource belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Is one of the following types: + BackupVaultResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.BackupVaultResource or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BackupVaultResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BackupVaultResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.PatchResourceRequestInput, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_vaults_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.PatchResourceRequestInput, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.PatchResourceRequestInput, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.BackupVaultResource]: + """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param parameters: Request body for operation. Is one of the following types: + PatchResourceRequestInput, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput or JSON or + IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: An instance of LROPoller that returns BackupVaultResource. The BackupVaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupVaultResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BackupVaultResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BackupVaultResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_backup_vaults_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a BackupVault resource from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_in_subscription(self, **kwargs: Any) -> ItemPaged["_models.BackupVaultResource"]: + """Returns resource collection belonging to a subscription. + + :return: An iterator like instance of BackupVaultResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupVaultResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_vaults_get_in_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupVaultResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_in_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.BackupVaultResource"]: + """Returns resource collection belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of BackupVaultResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupVaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupVaultResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_vaults_get_in_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupVaultResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: _models.CheckNameAvailabilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CheckNameAvailabilityRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """API to check for resource name availability. + + API to check for resource name availability. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Check name availability request. Is one of the following types: + CheckNameAvailabilityRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityRequest or JSON or + IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_vaults_check_name_availability_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusBackupVaultContextOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`operation_status_backup_vault_context` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any + ) -> _models.OperationResource: + """Gets the operation status for an operation over a BackupVault's context. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param operation_id: Required. + :type operation_id: str + :return: OperationResource. The OperationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) + + _request = build_operation_status_backup_vault_context_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExportJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`export_jobs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _trigger_initial(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_export_jobs_trigger_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: + """Triggers export of jobs and returns an OperationID to track. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._trigger_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ExportJobsOperationResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`export_jobs_operation_result` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any + ) -> Optional[_models.ExportJobsResult]: + """Gets the operation result of operation triggered by Export Jobs API. If the operation is + successful, then it also contains URL of a Blob and a SAS key to access the same. The blob + contains exported jobs in JSON serialized format. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the BackupVaultResource. Required. + :type vault_name: str + :param operation_id: OperationID which represents the export job. Required. + :type operation_id: str + :return: ExportJobsResult or None. The ExportJobsResult is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ExportJobsResult or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) + + _request = build_export_jobs_operation_result_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ExportJobsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BackupPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`backup_policies` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Gets a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) + + _request = build_backup_policies_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BaseBackupPolicyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: _models.BaseBackupPolicyResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + backup_policy_name: str, + parameters: Union[_models.BaseBackupPolicyResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.BaseBackupPolicyResource: + """Creates or Updates a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :param parameters: Request body for operation. Is one of the following types: + BaseBackupPolicyResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource or JSON or + IO[bytes] + :return: BaseBackupPolicyResource. The BaseBackupPolicyResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.BaseBackupPolicyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_backup_policies_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BaseBackupPolicyResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, backup_policy_name: str, **kwargs: Any + ) -> None: + """Deletes a backup policy belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_policy_name: Required. + :type backup_policy_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_backup_policies_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_policy_name=backup_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> ItemPaged["_models.BaseBackupPolicyResource"]: + """Returns list of backup policies belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of BaseBackupPolicyResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BaseBackupPolicyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BaseBackupPolicyResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_policies_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BaseBackupPolicyResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorableTimeRangesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`restorable_time_ranges` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: _models.AzureBackupFindRestorableTimeRangesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def find( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + parameters: Union[_models.AzureBackupFindRestorableTimeRangesRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: + """find. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the BackupInstanceResource. Required. + :type backup_instance_name: str + :param parameters: Request body for operation. Is one of the following types: + AzureBackupFindRestorableTimeRangesRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest + or JSON or IO[bytes] + :return: AzureBackupFindRestorableTimeRangesResponseResource. The + AzureBackupFindRestorableTimeRangesResponseResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_restorable_time_ranges_find_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupFindRestorableTimeRangesResponseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class RecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`recovery_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + recovery_point_id: str, + **kwargs: Any + ) -> _models.AzureBackupRecoveryPointResource: + """Gets a Recovery Point using recoveryPointId for a Datasource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :param recovery_point_id: Required. + :type recovery_point_id: str + :return: AzureBackupRecoveryPointResource. The AzureBackupRecoveryPointResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) + + _request = build_recovery_points_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + recovery_point_id=recovery_point_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupRecoveryPointResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + backup_instance_name: str, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Recovery Points for a DataSource in a vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the backup instance. Required. + :type backup_instance_name: str + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureBackupRecoveryPointResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_recovery_points_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupRecoveryPointResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class JobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`jobs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, job_id: str, **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Gets a job with id in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param job_id: The Job ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). Required. + :type job_id: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) + + _request = build_jobs_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + job_id=job_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupJobResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> ItemPaged["_models.AzureBackupJobResource"]: + """Returns list of jobs belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureBackupJobResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_jobs_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupJobResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DeletedBackupInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`deleted_backup_instances` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> _models.DeletedBackupInstanceResource: + """Gets a deleted backup instance with name in a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the deleted backup instance. Required. + :type backup_instance_name: str + :return: DeletedBackupInstanceResource. The DeletedBackupInstanceResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) + + _request = build_deleted_backup_instances_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedBackupInstanceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> ItemPaged["_models.DeletedBackupInstanceResource"]: + """Gets deleted backup instances belonging to a backup vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of DeletedBackupInstanceResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DeletedBackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedBackupInstanceResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_deleted_backup_instances_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedBackupInstanceResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _undelete_initial( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deleted_backup_instances_undelete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_undelete( + self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any + ) -> LROPoller[None]: + """A long-running resource action. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param backup_instance_name: The name of the deleted backup instance. Required. + :type backup_instance_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._undelete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + backup_instance_name=backup_instance_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DppResourceGuardProxyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`dpp_resource_guard_proxy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Returns the ResourceGuardProxy object associated with the vault, and that matches the name in + the request. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + _request = build_dpp_resource_guard_proxy_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardProxyBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.ResourceGuardProxyBaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.ResourceGuardProxyBaseResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ResourceGuardProxyBaseResource: + """Creates or Updates a ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is one of the following types: + ResourceGuardProxyBaseResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or JSON or + IO[bytes] + :return: ResourceGuardProxyBaseResource. The ResourceGuardProxyBaseResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dpp_resource_guard_proxy_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ResourceGuardProxyBaseResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any + ) -> None: + """Deletes the ResourceGuardProxy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_dpp_resource_guard_proxy_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> ItemPaged["_models.ResourceGuardProxyBaseResource"]: + """Returns the list of ResourceGuardProxies associated with the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :return: An iterator like instance of ResourceGuardProxyBaseResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ResourceGuardProxyBaseResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_dpp_resource_guard_proxy_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ResourceGuardProxyBaseResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: _models.UnlockDeleteRequest, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: JSON, + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: IO[bytes], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def unlock_delete( + self, + resource_group_name: str, + vault_name: str, + resource_guard_proxy_name: str, + parameters: Union[_models.UnlockDeleteRequest, JSON, IO[bytes]], + *, + x_ms_authorization_auxiliary: Optional[str] = None, + **kwargs: Any + ) -> _models.UnlockDeleteResponse: + """UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the backup vault. Required. + :type vault_name: str + :param resource_guard_proxy_name: name of the resource guard proxy. Required. + :type resource_guard_proxy_name: str + :param parameters: Request body for operation. Is one of the following types: + UnlockDeleteRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or JSON or IO[bytes] + :keyword x_ms_authorization_auxiliary: Default value is None. + :paramtype x_ms_authorization_auxiliary: str + :return: UnlockDeleteResponse. The UnlockDeleteResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_dpp_resource_guard_proxy_unlock_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + resource_guard_proxy_name=resource_guard_proxy_name, + subscription_id=self._config.subscription_id, + x_ms_authorization_auxiliary=x_ms_authorization_auxiliary, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.UnlockDeleteResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationResultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`operation_result` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_models.OperationJobExtendedInfo]: + """Gets the operation status for a resource. + + Gets the operation result for a resource. + + :param operation_id: Required. + :type operation_id: str + :param location: The name of the Azure region. Required. + :type location: str + :return: OperationJobExtendedInfo or None. The OperationJobExtendedInfo is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationJobExtendedInfo or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) + + _request = build_operation_result_get_request( + operation_id=operation_id, + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationJobExtendedInfo, response.json()) + + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`operation_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: + """Gets the operation status for a resource. + + Gets the operation status for a resource. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: Required. + :type operation_id: str + :return: OperationResource. The OperationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) + + _request = build_operation_status_get_request( + location=location, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationStatusResourceGroupContextOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`operation_status_resource_group_context` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: + """Gets the operation status for an operation over a ResourceGroup's context. + + Gets the operation status for an operation over a ResourceGroup's context. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param operation_id: Required. + :type operation_id: str + :return: OperationResource. The OperationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.OperationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) + + _request = build_operation_status_resource_group_context_get_request( + resource_group_name=resource_group_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DataProtectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`data_protection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def check_feature_support( + self, + location: str, + parameters: _models.FeatureValidationRequestBase, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_feature_support( + self, location: str, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_feature_support( + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_feature_support( + self, location: str, parameters: Union[_models.FeatureValidationRequestBase, JSON, IO[bytes]], **kwargs: Any + ) -> _models.FeatureValidationResponseBase: + """Validates if a feature is supported. + + Validates if a feature is supported. + + :param location: The location name. Required. + :type location: str + :param parameters: The request body. Is one of the following types: + FeatureValidationRequestBase, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.FeatureValidationRequestBase or JSON or + IO[bytes] + :return: FeatureValidationResponseBase. The FeatureValidationResponseBase is compatible with + MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.FeatureValidationResponseBase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FeatureValidationResponseBase] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_protection_check_feature_support_request( + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FeatureValidationResponseBase, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FetchSecondaryRecoveryPointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`fetch_secondary_recovery_points` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: _models.FetchSecondaryRPsRequestParameters, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype 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 + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype 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 + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype 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 + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.FetchSecondaryRPsRequestParameters, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupRecoveryPointResource"]: + """Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for + Cross Region Restore. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + FetchSecondaryRPsRequestParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.FetchSecondaryRPsRequestParameters or JSON + or IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword skip_token: skipToken Filter. Default value is None. + :paramtype skip_token: str + :return: An iterator like instance of AzureBackupRecoveryPointResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AzureBackupRecoveryPointResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_fetch_secondary_recovery_points_list_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + filter=filter, + skip_token=skip_token, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupRecoveryPointResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FetchCrossRegionRestoreJobOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`fetch_cross_region_restore_job` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def get( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AzureBackupJobResource: + """Fetches the Cross Region Restore Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + CrossRegionRestoreJobRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobRequest or JSON or + IO[bytes] + :return: AzureBackupJobResource. The AzureBackupJobResource is compatible with MutableMapping + :rtype: ~azure.mgmt.dataprotection.models.AzureBackupJobResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fetch_cross_region_restore_job_get_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureBackupJobResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FetchCrossRegionRestoreJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`fetch_cross_region_restore_jobs` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: _models.CrossRegionRestoreJobsRequest, + *, + filter: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: JSON, + *, + filter: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: JSON + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list( + self, + resource_group_name: str, + location: str, + parameters: IO[bytes], + *, + filter: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Required. + :type parameters: IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list( + self, + resource_group_name: str, + location: str, + parameters: Union[_models.CrossRegionRestoreJobsRequest, JSON, IO[bytes]], + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.AzureBackupJobResource"]: + """Fetches list of Cross Region Restore job belonging to the vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param parameters: Request body for operation. Is one of the following types: + CrossRegionRestoreJobsRequest, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.dataprotection.models.CrossRegionRestoreJobsRequest or JSON or + IO[bytes] + :keyword filter: OData filter options. Default value is None. + :paramtype filter: str + :return: An iterator like instance of AzureBackupJobResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupJobResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.AzureBackupJobResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_fetch_cross_region_restore_jobs_list_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + filter=filter, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureBackupJobResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BackupInstancesExtensionRoutingOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s + :attr:`backup_instances_extension_routing` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataProtectionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_id: str, **kwargs: Any) -> ItemPaged["_models.BackupInstanceResource"]: + """Gets a list of backup instances associated with a tracked resource. + + :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. + Required. + :type resource_id: str + :return: An iterator like instance of BackupInstanceResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupInstanceResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_backup_instances_extension_routing_list_request( + resource_id=resource_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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 + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BackupInstanceResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py deleted file mode 100644 index b1dd46031ec5..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py +++ /dev/null @@ -1,317 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, 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 _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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, - backup_instance_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - vault_name: str, - backup_instance_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RecoveryPointsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`recovery_points` 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, - backup_instance_name: str, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: - """Returns a list of Recovery Points for a DataSource in a vault. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_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 - :return: An iterator like instance of either AzureBackupRecoveryPointResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - recovery_point_id: str, - **kwargs: Any - ) -> _models.AzureBackupRecoveryPointResource: - """Gets a Recovery Point using recoveryPointId for a Datasource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param recovery_point_id: Required. - :type recovery_point_id: str - :return: AzureBackupRecoveryPointResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupRecoveryPointResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - recovery_point_id=recovery_point_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupRecoveryPointResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py deleted file mode 100644 index 4f9e23ff3c5d..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py +++ /dev/null @@ -1,2148 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_resources_in_subscription_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_resources_in_resource_group_request( # pylint: disable=name-too-long - resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_put_request( - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_patch_request( - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_disable_soft_delete_requests_objects_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_delete_resource_guard_proxy_requests_objects_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_backup_security_pin_requests_objects_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_delete_protected_item_requests_objects_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_update_protection_policy_requests_objects_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_update_protected_item_requests_objects_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_disable_soft_delete_requests_object_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - "requestName": _SERIALIZER.url("request_name", request_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_delete_resource_guard_proxy_requests_object_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - "requestName": _SERIALIZER.url("request_name", request_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_backup_security_pin_requests_object_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - "requestName": _SERIALIZER.url("request_name", request_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_delete_protected_item_requests_object_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - "requestName": _SERIALIZER.url("request_name", request_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_update_protection_policy_requests_object_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - "requestName": _SERIALIZER.url("request_name", request_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_update_protected_item_requests_object_request( # pylint: disable=name-too-long - resource_group_name: str, resource_guards_name: str, request_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), - "requestName": _SERIALIZER.url("request_name", request_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ResourceGuardsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`resource_guards` 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 get_resources_in_subscription(self, **kwargs: Any) -> Iterable["_models.ResourceGuardResource"]: - """Returns ResourceGuards collection belonging to a subscription. - - Returns ResourceGuards collection belonging to a subscription. - - :return: An iterator like instance of either ResourceGuardResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_resources_in_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_resources_in_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ResourceGuardResource"]: - """Returns ResourceGuards collection belonging to a ResourceGroup. - - Returns ResourceGuards collection belonging to a ResourceGroup. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ResourceGuardResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_resources_in_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceGuardResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def put( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: _models.ResourceGuardResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Creates or updates a ResourceGuard resource belonging to a resource group. - - Creates or updates a ResourceGuard resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Creates or updates a ResourceGuard resource belonging to a resource group. - - Creates or updates a ResourceGuard resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: Union[_models.ResourceGuardResource, IO[bytes]], - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Creates or updates a ResourceGuard resource belonging to a resource group. - - Creates or updates a ResourceGuard resource belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Is either a ResourceGuardResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardResource or IO[bytes] - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ResourceGuardResource") - - _request = build_put_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any) -> _models.ResourceGuardResource: - """Returns a ResourceGuard belonging to a resource group. - - Returns a ResourceGuard belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> None: - """Deletes a ResourceGuard resource from the resource group. - - Deletes a ResourceGuard resource from the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def patch( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: _models.PatchResourceGuardInput, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def patch( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def patch( - self, - resource_group_name: str, - resource_guards_name: str, - parameters: Union[_models.PatchResourceGuardInput, IO[bytes]], - **kwargs: Any - ) -> _models.ResourceGuardResource: - """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for - a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: The name of ResourceGuard. Required. - :type resource_guards_name: str - :param parameters: Request body for operation. Is either a PatchResourceGuardInput type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput or IO[bytes] - :return: ResourceGuardResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PatchResourceGuardInput") - - _request = build_patch_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_disable_soft_delete_requests_objects( - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> Iterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_disable_soft_delete_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_delete_resource_guard_proxy_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> Iterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_delete_resource_guard_proxy_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_backup_security_pin_requests_objects( - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> Iterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_backup_security_pin_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_delete_protected_item_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> Iterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_delete_protected_item_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_update_protection_policy_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> Iterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_update_protection_policy_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_update_protected_item_requests_objects( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, **kwargs: Any - ) -> Iterable["_models.DppBaseResource"]: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :return: An iterator like instance of either DppBaseResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.DppBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_get_update_protected_item_requests_objects_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DppBaseResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_default_disable_soft_delete_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_disable_soft_delete_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_default_delete_resource_guard_proxy_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_delete_resource_guard_proxy_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_default_backup_security_pin_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_backup_security_pin_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_default_delete_protected_item_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_delete_protected_item_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_default_update_protection_policy_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_update_protection_policy_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_default_update_protected_item_requests_object( # pylint: disable=name-too-long - self, resource_group_name: str, resource_guards_name: str, request_name: str, **kwargs: Any - ) -> _models.DppBaseResource: - """Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - Returns collection of operation request objects for a critical operation protected by the given - ResourceGuard resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_guards_name: Required. - :type resource_guards_name: str - :param request_name: Required. - :type request_name: str - :return: DppBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.DppBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) - - _request = build_get_default_update_protected_item_requests_object_request( - resource_group_name=resource_group_name, - resource_guards_name=resource_guards_name, - request_name=request_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DppBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py deleted file mode 100644 index 06b7d1a4193e..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py +++ /dev/null @@ -1,239 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, 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 -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_find_request( - resource_group_name: str, vault_name: str, backup_instance_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RestorableTimeRangesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionMgmtClient`'s - :attr:`restorable_time_ranges` 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") - - @overload - def find( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: _models.AzureBackupFindRestorableTimeRangesRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: - """find. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupFindRestorableTimeRangesResponseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def find( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: - """find. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureBackupFindRestorableTimeRangesResponseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def find( - self, - resource_group_name: str, - vault_name: str, - backup_instance_name: str, - parameters: Union[_models.AzureBackupFindRestorableTimeRangesRequest, IO[bytes]], - **kwargs: Any - ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: - """find. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param backup_instance_name: The name of the backup instance. Required. - :type backup_instance_name: str - :param parameters: Request body for operation. Is either a - AzureBackupFindRestorableTimeRangesRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesRequest - or IO[bytes] - :return: AzureBackupFindRestorableTimeRangesResponseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.AzureBackupFindRestorableTimeRangesResponseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AzureBackupFindRestorableTimeRangesRequest") - - _request = build_find_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - backup_instance_name=backup_instance_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureBackupFindRestorableTimeRangesResponseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py index 9c2526c117e5..5a72ca1ec059 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/check_backup_vaults_name_availability.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.check_name_availability( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json +# x-ms-original-file: 2025-07-01/VaultCRUD/CheckBackupVaultsNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py index 2a15d8bff824..d97d8f2ac6cb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.data_protection.check_feature_support( @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CheckfeatureSupport.json +# x-ms-original-file: 2025-07-01/CheckfeatureSupport.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py similarity index 90% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py index e2273ebe4cdc..8fd29cdd76a9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/create_or_update_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_policies.create_or_update( @@ -95,6 +93,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json +# x-ms-original-file: 2025-07-01/PolicyCRUD/CreateOrUpdateBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py index 13556bd61c23..8803ddd29dd0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/delete_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/DeleteBackupInstance.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/DeleteBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py index 6e7fee02b392..f4225651bd61 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/delete_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_policies.delete( @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/DeleteBackupPolicy.json +# x-ms-original-file: 2025-07-01/PolicyCRUD/DeleteBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py index d5fdd0ac38bc..83b0bccefc68 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/delete_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) client.backup_vaults.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/DeleteBackupVault.json +# x-ms-original-file: 2025-07-01/VaultCRUD/DeleteBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py index a81ad9812740..d487b6edcea5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/delete_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) client.resource_guards.delete( @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/DeleteResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py index e950921b3b50..244b8ee535b8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/delete_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard_proxy.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + subscription_id="SUBSCRIPTION_ID", ) client.dpp_resource_guard_proxy.delete( @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json +# x-ms-original-file: 2025-07-01/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py similarity index 78% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py index 9bc5bc4aef40..216c9719b5e1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_job.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + subscription_id="SUBSCRIPTION_ID", ) response = client.fetch_cross_region_restore_job.get( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/FetchCrossRegionRestoreJob.json +# x-ms-original-file: 2025-07-01/CrossRegionRestore/FetchCrossRegionRestoreJob.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py index 562ff663bb97..dddf88979c9c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_cross_region_restore_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_cross_region_restore_jobs.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + subscription_id="SUBSCRIPTION_ID", ) response = client.fetch_cross_region_restore_jobs.list( @@ -44,6 +43,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/FetchCrossRegionRestoreJobs.json +# x-ms-original-file: 2025-07-01/CrossRegionRestore/FetchCrossRegionRestoreJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py similarity index 78% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py index 3d83cafb2842..41e9d03c9973 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/fetch_secondary_rps.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/fetch_secondary_rps.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.fetch_secondary_recovery_points.list( @@ -44,6 +43,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/FetchSecondaryRPs.json +# x-ms-original-file: 2025-07-01/CrossRegionRestore/FetchSecondaryRPs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py index bc38d16427e1..de2e8046f25d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/find_restorable_time_ranges.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.restorable_time_ranges.find( @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/FindRestorableTimeRanges.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py index d17eaf2f2e03..857dfe3c472d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/GetBackupInstance.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/GetBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_adlsblob_backup_datasource_parameters.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_adlsblob_backup_datasource_parameters.py new file mode 100644 index 000000000000..48156c70ef5b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_adlsblob_backup_datasource_parameters.py @@ -0,0 +1,43 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_instance_adlsblob_backup_datasource_parameters.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.backup_instances.get( + resource_group_name="adlsrg", + vault_name="adlsvault", + backup_instance_name="adlsbackupinstance", + ) + print(response) + + +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/GetBackupInstance_ADLSBlobBackupDatasourceParameters.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py similarity index 78% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py index 8cbfa29bfad2..a78cfba8444e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_backup_instance_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.get_backup_instance_operation_result( @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/GetBackupInstanceOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py index e881df3cda4d..a7ade379fd83 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/get_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_policies.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/GetBackupPolicy.json +# x-ms-original-file: 2025-07-01/PolicyCRUD/GetBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py index 527cdbb9d2c4..4078b0ff5b25 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVault.json +# x-ms-original-file: 2025-07-01/VaultCRUD/GetBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_cmk.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_cmk.py index 4507887c3fec..17683ad16617 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_cmk.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_cmk.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultWithCMK.json +# x-ms-original-file: 2025-07-01/VaultCRUD/GetBackupVaultWithCMK.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py index d42aff54d2d2..45ada4960edb 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultWithMSI.json +# x-ms-original-file: 2025-07-01/VaultCRUD/GetBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py index 2ff6a8ebad33..7634ab47ab35 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.get_in_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json +# x-ms-original-file: 2025-07-01/VaultCRUD/GetBackupVaultsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py index 3cf0732e5e7f..961104ebf3f2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_backup_vaults_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.get_in_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json +# x-ms-original-file: 2025-07-01/VaultCRUD/GetBackupVaultsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py index 3603dd8d05c6..c42e74345866 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_default_backup_security_pin_requests_object( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py index 31ed30f8bdae..8a589d7ee615 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_default_delete_protected_item_requests_object( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py index 10b88c7a46f7..98c5b2ced504 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_default_delete_resource_guard_proxy_requests_object( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py index d3f1f336538a..afcaefe6b3fd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_default_disable_soft_delete_requests_object( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py index a0050f3a114f..8ef428ac88de 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_default_update_protected_item_requests_object( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py index bca4f4bf8f59..d99522529886 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_default_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_default_update_protection_policy_requests_object( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py index 7be303f55289..2c006adc5652 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/get_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.deleted_backup_instances.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json +# x-ms-original-file: 2025-07-01/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py index 2ced5becbee8..2979427bdd6f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_export_jobs_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.export_jobs_operation_result.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/GetExportJobsOperationResult.json +# x-ms-original-file: 2025-07-01/JobCRUD/GetExportJobsOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py index cb84bfe490e4..4ec24cbd242f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/get_job.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + subscription_id="SUBSCRIPTION_ID", ) response = client.jobs.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/GetJob.json +# x-ms-original-file: 2025-07-01/JobCRUD/GetJob.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py index 84c238dbc9c8..0c1af767d6a1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_result.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationResult.json +# x-ms-original-file: 2025-07-01/GetOperationResult.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py similarity index 78% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py index f0d326d644ec..55e776b78e03 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/get_operation_result_patch.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vault_operation_results.get( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/GetOperationResultPatch.json +# x-ms-original-file: 2025-07-01/VaultCRUD/GetOperationResultPatch.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py index 16dcda099e7f..f36a2deec777 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_status.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationStatus.json +# x-ms-original-file: 2025-07-01/GetOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py index 446cfdfec1a8..4cd6302b4b58 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_status_resource_group_context.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationStatusRGContext.json +# x-ms-original-file: 2025-07-01/GetOperationStatusRGContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py index 788c063ede45..275cc23268e0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_status_backup_vault_context.get( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/GetOperationStatusVaultContext.json +# x-ms-original-file: 2025-07-01/GetOperationStatusVaultContext.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py index 93e87ee1df16..eb654281067d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/get_recovery_point.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.recovery_points.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/GetRecoveryPoint.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/GetRecoveryPoint.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py index c3666b6407fb..10d3f1f366c8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetResourceGuard.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py index 7b3a32e7dacd..4de6a492a75e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/get_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard_proxy.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + subscription_id="SUBSCRIPTION_ID", ) response = client.dpp_resource_guard_proxy.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json +# x-ms-original-file: 2025-07-01/ResourceGuardProxyCRUD/GetResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py index f26da44fe848..13f2cb1ab495 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_resource_group.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_resources_in_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py index 85df4b590d21..36063a49f2e1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/get_resource_guards_in_subscription.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_resources_in_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/GetResourceGuardsInSubscription.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py similarity index 79% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py index 7a88a8308805..6ff03e32ca1c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/operations/list.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/Operations/List.json +# x-ms-original-file: 2025-07-01/Operations/List.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py index 0b57b80490a9..1fc1889174d8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ListBackupInstances.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ListBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py similarity index 79% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py index 68687fad5281..8e0ee467ffce 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_backup_instances_extension_routing.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances_extension_routing.py @@ -1,14 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,7 +26,7 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py index 64c15ce0e631..5457a9dd2be0 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/policy_crud/list_backup_policy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_policies.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/PolicyCRUD/ListBackupPolicy.json +# x-ms-original-file: 2025-07-01/PolicyCRUD/ListBackupPolicy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py index 430645782f4c..3451d4d5e5bc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_backup_security_pin_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_backup_security_pin_requests_objects( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/ListBackupSecurityPINRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py index 51275bcf898a..d731f26be999 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_delete_protected_item_requests_objects( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py index f108c0045db5..887c1e581bef 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_delete_resource_guard_proxy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_delete_resource_guard_proxy_requests_objects( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py index 32710025c57a..e9ce034ed5df 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/list_deleted_backup_instances.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.deleted_backup_instances.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json +# x-ms-original-file: 2025-07-01/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py index f5e5512e41b3..72375c6b730c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_disable_soft_delete_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_disable_soft_delete_requests_objects( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py index 4500a3bc66d4..8f3b165bfc61 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/list_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + subscription_id="SUBSCRIPTION_ID", ) response = client.jobs.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/ListJobs.json +# x-ms-original-file: 2025-07-01/JobCRUD/ListJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py index 828d96717086..c66790fbb2a8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/list_recovery_points.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.recovery_points.list( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ListRecoveryPoints.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ListRecoveryPoints.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py index ad626b87240a..920195e77689 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/list_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_resource_guard_proxy.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + subscription_id="SUBSCRIPTION_ID", ) response = client.dpp_resource_guard_proxy.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json +# x-ms-original-file: 2025-07-01/ResourceGuardProxyCRUD/ListResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py index b54da0480395..cf2090fc7b4c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protected_item_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_update_protected_item_requests_objects( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py index c7b0faf2878d..3f4ed30b9472 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/list_update_protection_policy_requests.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.get_update_protection_policy_requests_objects( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py index 7dac9a7be9d0..d2bbce05bc43 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.begin_update( @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PatchBackupVault.json +# x-ms-original-file: 2025-07-01/VaultCRUD/PatchBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault_with_cmk.py similarity index 83% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault_with_cmk.py index e303ee0c0805..c64d13bddbf2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/patch_backup_vault_with_cmk.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault_with_cmk.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.begin_update( @@ -57,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PatchBackupVaultWithCMK.json +# x-ms-original-file: 2025-07-01/VaultCRUD/PatchBackupVaultWithCMK.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py index b40c5096e602..9e43826db467 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/patch_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.patch( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/PatchResourceGuard.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/PatchResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py similarity index 85% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py index be62f8614e0e..2cb12d90296e 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_create_or_update( @@ -64,6 +63,10 @@ def main(): }, }, "friendlyName": "harshitbi2", + "identityDetails": { + "useSystemAssignedIdentity": False, + "userAssignedIdentityArmUrl": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourcegroups/rg-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUami", + }, "objectType": "BackupInstance", "policyInfo": { "policyId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1", @@ -78,13 +81,12 @@ def main(): }, }, "validationType": "ShallowValidation", - }, - "tags": {"key1": "val1"}, + } }, ).result() print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/PutBackupInstance.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/PutBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_adlsblob_backup_datasource_parameters.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_adlsblob_backup_datasource_parameters.py new file mode 100644 index 000000000000..c872f7dfc0b9 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_adlsblob_backup_datasource_parameters.py @@ -0,0 +1,76 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_instance_adlsblob_backup_datasource_parameters.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.backup_instances.begin_create_or_update( + resource_group_name="adlsrg", + vault_name="adlsvault", + backup_instance_name="adlsstorageaccount-adlsstorageaccount-19a76f8a-c176-4f7d-819e-95157e2b0071", + parameters={ + "properties": { + "dataSourceInfo": { + "datasourceType": "Microsoft.Storage/storageAccounts/adlsBlobServices", + "objectType": "Datasource", + "resourceID": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + "resourceLocation": "centraluseuap", + "resourceName": "adlsstorageaccount", + "resourceType": "microsoft.storage/storageAccounts", + "resourceUri": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + }, + "dataSourceSetInfo": { + "datasourceType": "Microsoft.Storage/storageAccounts/adlsBlobServices", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + "resourceLocation": "centraluseuap", + "resourceName": "adlsstorageaccount", + "resourceType": "microsoft.storage/storageAccounts", + "resourceUri": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.Storage/storageAccounts/adlsstorageaccount", + }, + "friendlyName": "adlsstorageaccount\\adlsbackupinstance", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/54707983-993e-43de-8d94-074451394eda/resourceGroups/adlsrg/providers/Microsoft.DataProtection/backupVaults/adlsvault/backupPolicies/adlspolicy", + "policyParameters": { + "backupDatasourceParametersList": [ + {"containersList": ["container1"], "objectType": "AdlsBlobBackupDatasourceParameters"} + ] + }, + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/PutBackupInstance_ADLSBlobBackupDatasourceParameters.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py new file mode 100644 index 000000000000..147deecd501e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py @@ -0,0 +1,93 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_instance_kubernetes_cluster_backup_datasource_parameters.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.backup_instances.begin_create_or_update( + resource_group_name="aksrg", + vault_name="aksvault", + backup_instance_name="aksbi", + parameters={ + "properties": { + "dataSourceInfo": { + "datasourceType": "Microsoft.ContainerService/managedclusters", + "objectType": "Datasource", + "resourceID": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + "resourceLocation": "eastus2euap", + "resourceName": "akscluster", + "resourceType": "Microsoft.ContainerService/managedclusters", + "resourceUri": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + }, + "dataSourceSetInfo": { + "datasourceType": "Microsoft.ContainerService/managedclusters", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + "resourceLocation": "eastus2euap", + "resourceName": "akscluster", + "resourceType": "Microsoft.ContainerService/managedclusters", + "resourceUri": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg/providers/Microsoft.ContainerService/managedClusters/akscluster", + }, + "friendlyName": "aksbi", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourcegroups/aksrg/providers/Microsoft.DataProtection/BackupVaults/aksvault/backupPolicies/akspolicy", + "policyParameters": { + "backupDatasourceParametersList": [ + { + "excludedNamespaces": ["kube-system"], + "excludedResourceTypes": ["v1/Secret"], + "includeClusterScopeResources": True, + "includedNamespaces": ["test"], + "includedResourceTypes": [], + "includedVolumeTypes": ["AzureDisk", "AzureFileShareSMB"], + "labelSelectors": [], + "objectType": "KubernetesClusterBackupDatasourceParameters", + "snapshotVolumes": True, + } + ], + "dataStoreParametersList": [ + { + "dataStoreType": "OperationalStore", + "objectType": "AzureOperationalStoreParameters", + "resourceGroupId": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/aksrg", + } + ], + }, + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/PutBackupInstance_KubernetesClusterBackupDatasourceParameters.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_resource_guard_enabled.py similarity index 89% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_resource_guard_enabled.py index bc9c7cdc6d90..616971464039 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/put_backup_instance_resource_guard_enabled.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance_resource_guard_enabled.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_create_or_update( @@ -81,13 +80,12 @@ def main(): "/subscriptions/38304e13-357e-405e-9e9a-220351dcce8c/resourcegroups/ankurResourceGuard1/providers/Microsoft.DataProtection/resourceGuards/ResourceGuard38-1/dppModifyPolicy/default" ], "validationType": "ShallowValidation", - }, - "tags": {"key1": "val1"}, + } }, ).result() print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/PutBackupInstance_ResourceGuardEnabled.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/PutBackupInstance_ResourceGuardEnabled.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py similarity index 79% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py index 3211aaf4e361..09d31cc63bd3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,16 +25,15 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.begin_create_or_update( resource_group_name="SampleResourceGroup", vault_name="swaggerExample", parameters={ - "identity": {"type": "None"}, "location": "WestUS", "properties": { "featureSettings": {"crossRegionRestoreSettings": {"state": "Enabled"}}, @@ -50,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PutBackupVault.json +# x-ms-original-file: 2025-07-01/VaultCRUD/PutBackupVault.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_cmk.py similarity index 84% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_cmk.py index 78e9a47082a7..8472d22a0a99 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_cmk.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_cmk.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,16 +26,15 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.begin_create_or_update( resource_group_name="SampleResourceGroup", vault_name="swaggerExample", parameters={ - "identity": {"type": "None"}, "location": "WestUS", "properties": { "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "Enabled"}}, @@ -63,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PutBackupVaultWithCMK.json +# x-ms-original-file: 2025-07-01/VaultCRUD/PutBackupVaultWithCMK.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py similarity index 79% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py index 64e832da3a2a..cf108928bc1a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/vault_crud/put_backup_vault_with_msi.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,16 +25,15 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_vaults.begin_create_or_update( resource_group_name="SampleResourceGroup", vault_name="swaggerExample", parameters={ - "identity": {"type": "systemAssigned"}, "location": "WestUS", "properties": { "featureSettings": {"crossRegionRestoreSettings": {"state": "Enabled"}}, @@ -50,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/VaultCRUD/PutBackupVaultWithMSI.json +# x-ms-original-file: 2025-07-01/VaultCRUD/PutBackupVaultWithMSI.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py index a1cc47107e27..c7892c7447ab 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_crud/put_resource_guard.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + subscription_id="SUBSCRIPTION_ID", ) response = client.resource_guards.put( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardCRUD/PutResourceGuard.json +# x-ms-original-file: 2025-07-01/ResourceGuardCRUD/PutResourceGuard.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py similarity index 78% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py index b1ea1686991b..f2b01586948b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/put_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard_proxy.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + subscription_id="SUBSCRIPTION_ID", ) response = client.dpp_resource_guard_proxy.create_or_update( @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json +# x-ms-original-file: 2025-07-01/ResourceGuardProxyCRUD/PutResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py index 3a9cace6e7ab..72eef3b8627f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_resume_backups( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ResumeBackups.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ResumeBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py index 28ade62fc02a..5832ca7f0355 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/resume_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_resume_protection( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ResumeProtection.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ResumeProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py index 34f8b05c9acb..2890020756ac 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_stop_protection( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/StopProtection.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/StopProtection.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection_resource_guard_enabled.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection_resource_guard_enabled.py index 4879ca5ec5c2..28cfdefad0b8 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/stop_protection_resource_guard_enabled.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection_resource_guard_enabled.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_stop_protection( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/StopProtection_ResourceGuardEnabled.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/StopProtection_ResourceGuardEnabled.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backup_resource_guard_enabled.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backup_resource_guard_enabled.py index deb8fdb3c4c0..2c7d7f79e115 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backup_resource_guard_enabled.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backup_resource_guard_enabled.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_suspend_backups( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/SuspendBackup_ResourceGuardEnabled.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/SuspendBackup_ResourceGuardEnabled.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py index 278000fba52c..954ee8b652ac 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/suspend_backups.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_suspend_backups( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/SuspendBackups.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/SuspendBackups.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py index ab15f550a395..842ced6e424a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/sync_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_sync_backup_instance( @@ -40,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/SyncBackupInstance.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/SyncBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py index 309ab24a0fcd..36e97fdfeb7f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_adhoc_backup( @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerBackup.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/TriggerBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py similarity index 90% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py index 0a3a4e27eced..089a339d963b 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/trigger_cross_region_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_cross_region_restore.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_trigger_cross_region_restore( @@ -81,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/TriggerCrossRegionRestore.json +# x-ms-original-file: 2025-07-01/CrossRegionRestore/TriggerCrossRegionRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py similarity index 76% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py index f5bcc623859f..4641cf9820bc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/job_crud/trigger_export_jobs.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.export_jobs.begin_trigger( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/JobCRUD/TriggerExportJobs.json +# x-ms-original-file: 2025-07-01/JobCRUD/TriggerExportJobs.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py similarity index 77% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py index 990052a83f2c..b057f27b918c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_rehydrate.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.backup_instances.begin_trigger_rehydrate( @@ -44,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRehydrate.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/TriggerRehydrate.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py similarity index 84% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py index df77ad132850..7a14eef25da2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_trigger_restore( @@ -37,6 +36,10 @@ def main(): vault_name="PratikPrivatePreviewVault1", backup_instance_name="testInstance1", parameters={ + "identityDetails": { + "useSystemAssignedIdentity": False, + "userAssignedIdentityArmUrl": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourcegroups/rg-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUami", + }, "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", "recoveryPointId": "hardcodedRP", "restoreTargetInfo": { @@ -76,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRestore.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/TriggerRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py similarity index 83% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py index 25c3767eaba8..a2ec6aae49af 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_as_files.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_trigger_restore( @@ -56,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/TriggerRestoreAsFiles.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py similarity index 87% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py index 55af77488e62..79437167d852 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/trigger_restore_with_rehydration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_trigger_restore( @@ -71,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/TriggerRestoreWithRehydration.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py similarity index 75% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py index 9fdc8c8785ed..dc4b4b6e9d39 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/deleted_backup_instance_operations/undelete_deleted_backup_instance.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) client.deleted_backup_instances.begin_undelete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json +# x-ms-original-file: 2025-07-01/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py similarity index 80% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py index 219a7e5983e2..43f337736eb7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resource_guard_proxy_crud/unlock_delete_resource_guard_proxy.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/unlock_delete_resource_guard_proxy.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="5e13b949-1218-4d18-8b99-7e12155ec4f7", + subscription_id="SUBSCRIPTION_ID", ) response = client.dpp_resource_guard_proxy.unlock_delete( @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json +# x-ms-original-file: 2025-07-01/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py similarity index 90% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py index bbe19e16c014..86aaf39a6eba 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/cross_region_restore/validate_cross_region_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_cross_region_restore.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_validate_cross_region_restore( @@ -81,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/CrossRegionRestore/ValidateCrossRegionRestore.json +# x-ms-original-file: 2025-07-01/CrossRegionRestore/ValidateCrossRegionRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py similarity index 83% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py index 2affb2d94c69..3d502e7c32c1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_for_backup.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_validate_for_backup( @@ -63,6 +62,10 @@ def main(): }, }, "friendlyName": "harshitbi2", + "identityDetails": { + "useSystemAssignedIdentity": False, + "userAssignedIdentityArmUrl": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourcegroups/rg-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUami", + }, "objectType": "BackupInstance", "policyInfo": { "policyId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1" @@ -73,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ValidateForBackup.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ValidateForBackup.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_modify_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_modify_backup.py new file mode 100644 index 000000000000..e6cd7606a69f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_modify_backup.py @@ -0,0 +1,81 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python validate_for_modify_backup.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.backup_instances.begin_validate_for_modify_backup( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "datasourceType": "OssDB", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + "resourceLocation": "", + "resourceName": "testdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "dataSourceSetInfo": { + "datasourceType": "OssDB", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "friendlyName": "harshitbi2", + "identityDetails": { + "useSystemAssignedIdentity": False, + "userAssignedIdentityArmUrl": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourcegroups/rg-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUami", + }, + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1" + }, + } + }, + ).result() + + +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ValidateForModifyBackup.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py similarity index 85% rename from sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py rename to sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py index 593b9961325f..4292aab7a02c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/backup_instance_operations/validate_restore.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential -from azure.mgmt.dataprotection import DataProtectionMgmtClient +from azure.mgmt.dataprotection import DataProtectionClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = DataProtectionMgmtClient( + client = DataProtectionClient( credential=DefaultAzureCredential(), - subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + subscription_id="SUBSCRIPTION_ID", ) response = client.backup_instances.begin_validate_for_restore( @@ -38,6 +37,10 @@ def main(): backup_instance_name="testInstance1", parameters={ "restoreRequestObject": { + "identityDetails": { + "useSystemAssignedIdentity": False, + "userAssignedIdentityArmUrl": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourcegroups/rg-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUami", + }, "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", "recoveryPointId": "hardcodedRP", "restoreTargetInfo": { @@ -78,6 +81,6 @@ def main(): print(response) -# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2024-04-01/examples/BackupInstanceOperations/ValidateRestore.json +# x-ms-original-file: 2025-07-01/BackupInstanceOperations/ValidateRestore.json if __name__ == "__main__": main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py new file mode 100644 index 000000000000..4742abaa212f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + dataprotection_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + dataprotection_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + dataprotection_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + dataprotection_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotection_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotection_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotection_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=dataprotection_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_extension_routing_operations.py new file mode 100644 index 000000000000..ca2265ff6f91 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_extension_routing_operations.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupInstancesExtensionRoutingOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_extension_routing_list(self, resource_group): + response = self.client.backup_instances_extension_routing.list( + resource_id="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_extension_routing_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_extension_routing_operations_async.py new file mode 100644 index 000000000000..7554ed8daa51 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_extension_routing_operations_async.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupInstancesExtensionRoutingOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_extension_routing_list(self, resource_group): + response = self.client.backup_instances_extension_routing.list( + resource_id="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_operations.py new file mode 100644 index 000000000000..b7ceb71874e0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_operations.py @@ -0,0 +1,462 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_get_backup_instance_operation_result(self, resource_group): + response = self.client.backup_instances.get_backup_instance_operation_result( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_list(self, resource_group): + response = self.client.backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_for_backup(self, resource_group): + response = self.client.backup_instances.begin_validate_for_backup( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_get(self, resource_group): + response = self.client.backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_create_or_update(self, resource_group): + response = self.client.backup_instances.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_delete(self, resource_group): + response = self.client.backup_instances.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_adhoc_backup(self, resource_group): + response = self.client.backup_instances.begin_adhoc_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"backupRuleOptions": {"ruleName": "str", "triggerOption": {"retentionTagOverride": "str"}}}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_for_modify_backup(self, resource_group): + response = self.client.backup_instances.begin_validate_for_modify_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_trigger_rehydrate(self, resource_group): + response = self.client.backup_instances.begin_trigger_rehydrate( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"recoveryPointId": "str", "rehydrationRetentionDuration": "str", "rehydrationPriority": "str"}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_trigger_restore(self, resource_group): + response = self.client.backup_instances.begin_trigger_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "objectType": "AzureBackupRestoreWithRehydrationRequest", + "recoveryPointId": "str", + "rehydrationPriority": "str", + "rehydrationRetentionDuration": "str", + "restoreTargetInfo": "restore_target_info_base", + "sourceDataStoreType": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "resourceGuardOperationRequests": ["str"], + "sourceResourceId": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_resume_backups(self, resource_group): + response = self.client.backup_instances.begin_resume_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_resume_protection(self, resource_group): + response = self.client.backup_instances.begin_resume_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_stop_protection(self, resource_group): + response = self.client.backup_instances.begin_stop_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_suspend_backups(self, resource_group): + response = self.client.backup_instances.begin_suspend_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_sync_backup_instance(self, resource_group): + response = self.client.backup_instances.begin_sync_backup_instance( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"syncType": "str"}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_for_restore(self, resource_group): + response = self.client.backup_instances.begin_validate_for_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"restoreRequestObject": "azure_backup_restore_request"}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_trigger_cross_region_restore(self, resource_group): + response = self.client.backup_instances.begin_trigger_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_instances_begin_validate_cross_region_restore(self, resource_group): + response = self.client.backup_instances.begin_validate_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_operations_async.py new file mode 100644 index 000000000000..59d5940996ad --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_instances_operations_async.py @@ -0,0 +1,509 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_get_backup_instance_operation_result(self, resource_group): + response = await self.client.backup_instances.get_backup_instance_operation_result( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_list(self, resource_group): + response = self.client.backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_for_backup(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_for_backup( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": { + "additionalInfo": {"str": "str"}, + "code": "str", + "embeddedInnerError": ..., + }, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_get(self, resource_group): + response = await self.client.backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_create_or_update(self, resource_group): + response = await ( + await self.client.backup_instances.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": { + "additionalInfo": {"str": "str"}, + "code": "str", + "embeddedInnerError": ..., + }, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_delete(self, resource_group): + response = await ( + await self.client.backup_instances.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_adhoc_backup(self, resource_group): + response = await ( + await self.client.backup_instances.begin_adhoc_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"backupRuleOptions": {"ruleName": "str", "triggerOption": {"retentionTagOverride": "str"}}}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_for_modify_backup(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_for_modify_backup( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "objectType": "str", + "policyInfo": { + "policyId": "str", + "policyParameters": { + "backupDatasourceParametersList": ["backup_datasource_parameters"], + "dataStoreParametersList": ["data_store_parameters"], + }, + "policyVersion": "str", + }, + "currentProtectionState": "str", + "dataSourceSetInfo": { + "resourceID": "str", + "datasourceType": "str", + "objectType": "str", + "resourceLocation": "str", + "resourceName": "str", + "resourceProperties": "base_resource_properties", + "resourceType": "str", + "resourceUri": "str", + }, + "datasourceAuthCredentials": "auth_credentials", + "friendlyName": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "protectionErrorDetails": { + "code": "str", + "details": [...], + "innerError": {"additionalInfo": {"str": "str"}, "code": "str", "embeddedInnerError": ...}, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "protectionStatus": { + "errorDetails": { + "code": "str", + "details": [...], + "innerError": { + "additionalInfo": {"str": "str"}, + "code": "str", + "embeddedInnerError": ..., + }, + "isRetryable": bool, + "isUserError": bool, + "message": "str", + "properties": {"str": "str"}, + "recommendedAction": ["str"], + "target": "str", + }, + "status": "str", + }, + "provisioningState": "str", + "resourceGuardOperationRequests": ["str"], + "validationType": "str", + } + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_trigger_rehydrate(self, resource_group): + response = await ( + await self.client.backup_instances.begin_trigger_rehydrate( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "recoveryPointId": "str", + "rehydrationRetentionDuration": "str", + "rehydrationPriority": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_trigger_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_trigger_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={ + "objectType": "AzureBackupRestoreWithRehydrationRequest", + "recoveryPointId": "str", + "rehydrationPriority": "str", + "rehydrationRetentionDuration": "str", + "restoreTargetInfo": "restore_target_info_base", + "sourceDataStoreType": "str", + "identityDetails": {"useSystemAssignedIdentity": bool, "userAssignedIdentityArmUrl": "str"}, + "resourceGuardOperationRequests": ["str"], + "sourceResourceId": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_resume_backups(self, resource_group): + response = await ( + await self.client.backup_instances.begin_resume_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_resume_protection(self, resource_group): + response = await ( + await self.client.backup_instances.begin_resume_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_stop_protection(self, resource_group): + response = await ( + await self.client.backup_instances.begin_stop_protection( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_suspend_backups(self, resource_group): + response = await ( + await self.client.backup_instances.begin_suspend_backups( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_sync_backup_instance(self, resource_group): + response = await ( + await self.client.backup_instances.begin_sync_backup_instance( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"syncType": "str"}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_for_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_for_restore( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"restoreRequestObject": "azure_backup_restore_request"}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_trigger_cross_region_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_trigger_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_instances_begin_validate_cross_region_restore(self, resource_group): + response = await ( + await self.client.backup_instances.begin_validate_cross_region_restore( + resource_group_name=resource_group.name, + location="str", + parameters={ + "crossRegionRestoreDetails": {"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + "restoreRequestObject": "azure_backup_restore_request", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_policies_operations.py new file mode 100644 index 000000000000..b424277584e3 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_policies_operations.py @@ -0,0 +1,80 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_get(self, resource_group): + response = self.client.backup_policies.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_create_or_update(self, resource_group): + response = self.client.backup_policies.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": "base_backup_policy", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_delete(self, resource_group): + response = self.client.backup_policies.delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_policies_list(self, resource_group): + response = self.client.backup_policies.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_policies_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_policies_operations_async.py new file mode 100644 index 000000000000..868c91314d45 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_policies_operations_async.py @@ -0,0 +1,81 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_get(self, resource_group): + response = await self.client.backup_policies.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_create_or_update(self, resource_group): + response = await self.client.backup_policies.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": "base_backup_policy", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_delete(self, resource_group): + response = await self.client.backup_policies.delete( + resource_group_name=resource_group.name, + vault_name="str", + backup_policy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_policies_list(self, resource_group): + response = self.client.backup_policies.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vault_operation_results_operations.py new file mode 100644 index 000000000000..d604ab26b02c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vault_operation_results_operations.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupVaultOperationResultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vault_operation_results_get(self, resource_group): + response = self.client.backup_vault_operation_results.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vault_operation_results_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vault_operation_results_operations_async.py new file mode 100644 index 000000000000..6bce8e3ecfec --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vault_operation_results_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupVaultOperationResultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vault_operation_results_get(self, resource_group): + response = await self.client.backup_vault_operation_results.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vaults_operations.py new file mode 100644 index 000000000000..f8e568bdb753 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vaults_operations.py @@ -0,0 +1,174 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupVaultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_get(self, resource_group): + response = self.client.backup_vaults.get( + resource_group_name=resource_group.name, + vault_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_begin_create_or_update(self, resource_group): + response = self.client.backup_vaults.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "location": "str", + "properties": { + "storageSettings": [{"datastoreType": "str", "type": "str"}], + "bcdrSecurityLevel": "str", + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "isVaultProtectedByResourceGuard": bool, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "provisioningState": "str", + "replicatedRegions": ["str"], + "resourceGuardOperationRequests": ["str"], + "resourceMoveDetails": { + "completionTimeUtc": "str", + "operationId": "str", + "sourceResourcePath": "str", + "startTimeUtc": "str", + "targetResourcePath": "str", + }, + "resourceMoveState": "str", + "secureScore": "str", + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "eTag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_begin_update(self, resource_group): + response = self.client.backup_vaults.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "resourceGuardOperationRequests": ["str"], + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_begin_delete(self, resource_group): + response = self.client.backup_vaults.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_get_in_subscription(self, resource_group): + response = self.client.backup_vaults.get_in_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_get_in_resource_group(self, resource_group): + response = self.client.backup_vaults.get_in_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_backup_vaults_check_name_availability(self, resource_group): + response = self.client.backup_vaults.check_name_availability( + resource_group_name=resource_group.name, + location="str", + parameters={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vaults_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vaults_operations_async.py new file mode 100644 index 000000000000..f8adc79f776a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_backup_vaults_operations_async.py @@ -0,0 +1,181 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionBackupVaultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_get(self, resource_group): + response = await self.client.backup_vaults.get( + resource_group_name=resource_group.name, + vault_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_begin_create_or_update(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "location": "str", + "properties": { + "storageSettings": [{"datastoreType": "str", "type": "str"}], + "bcdrSecurityLevel": "str", + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "isVaultProtectedByResourceGuard": bool, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "provisioningState": "str", + "replicatedRegions": ["str"], + "resourceGuardOperationRequests": ["str"], + "resourceMoveDetails": { + "completionTimeUtc": "str", + "operationId": "str", + "sourceResourcePath": "str", + "startTimeUtc": "str", + "targetResourcePath": "str", + }, + "resourceMoveState": "str", + "secureScore": "str", + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "eTag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_begin_update(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_update( + resource_group_name=resource_group.name, + vault_name="str", + parameters={ + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "featureSettings": { + "crossRegionRestoreSettings": {"state": "str"}, + "crossSubscriptionRestoreSettings": {"state": "str"}, + }, + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "str"}}, + "resourceGuardOperationRequests": ["str"], + "securitySettings": { + "encryptionSettings": { + "infrastructureEncryption": "str", + "kekIdentity": {"identityId": "str", "identityType": "str"}, + "keyVaultProperties": {"keyUri": "str"}, + "state": "str", + }, + "immutabilitySettings": {"state": "str"}, + "softDeleteSettings": {"retentionDurationInDays": 0.0, "state": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_begin_delete(self, resource_group): + response = await ( + await self.client.backup_vaults.begin_delete( + resource_group_name=resource_group.name, + vault_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_get_in_subscription(self, resource_group): + response = self.client.backup_vaults.get_in_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_get_in_resource_group(self, resource_group): + response = self.client.backup_vaults.get_in_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_backup_vaults_check_name_availability(self, resource_group): + response = await self.client.backup_vaults.check_name_availability( + resource_group_name=resource_group.name, + location="str", + parameters={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations.py new file mode 100644 index 000000000000..c14c5ffb4bbf --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDataProtectionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_protection_check_feature_support(self, resource_group): + response = self.client.data_protection.check_feature_support( + location="str", + parameters={"objectType": "FeatureValidationRequest", "featureName": "str", "featureType": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_async.py new file mode 100644 index 000000000000..1b37ffa24337 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDataProtectionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_protection_check_feature_support(self, resource_group): + response = await self.client.data_protection.check_feature_support( + location="str", + parameters={"objectType": "FeatureValidationRequest", "featureName": "str", "featureType": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_operations.py new file mode 100644 index 000000000000..05f2931e7677 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_operations.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDataProtectionOperationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_protection_operations_list(self, resource_group): + response = self.client.data_protection_operations.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_operations_async.py new file mode 100644 index 000000000000..354aeb8ba126 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_data_protection_operations_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDataProtectionOperationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_protection_operations_list(self, resource_group): + response = self.client.data_protection_operations.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_deleted_backup_instances_operations.py new file mode 100644 index 000000000000..e7e04912195e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_deleted_backup_instances_operations.py @@ -0,0 +1,54 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDeletedBackupInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_backup_instances_get(self, resource_group): + response = self.client.deleted_backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_backup_instances_list(self, resource_group): + response = self.client.deleted_backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_backup_instances_begin_undelete(self, resource_group): + response = self.client.deleted_backup_instances.begin_undelete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_deleted_backup_instances_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_deleted_backup_instances_operations_async.py new file mode 100644 index 000000000000..39b5827584ff --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_deleted_backup_instances_operations_async.py @@ -0,0 +1,57 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDeletedBackupInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_backup_instances_get(self, resource_group): + response = await self.client.deleted_backup_instances.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_backup_instances_list(self, resource_group): + response = self.client.deleted_backup_instances.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_backup_instances_begin_undelete(self, resource_group): + response = await ( + await self.client.deleted_backup_instances.begin_undelete( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_dpp_resource_guard_proxy_operations.py new file mode 100644 index 000000000000..60a5c8023001 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_dpp_resource_guard_proxy_operations.py @@ -0,0 +1,100 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDppResourceGuardProxyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_get(self, resource_group): + response = self.client.dpp_resource_guard_proxy.get( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_create_or_update(self, resource_group): + response = self.client.dpp_resource_guard_proxy.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "description": "str", + "lastUpdatedTime": "str", + "resourceGuardOperationDetails": [ + {"defaultResourceRequest": "str", "vaultCriticalOperation": "str"} + ], + "resourceGuardResourceId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_delete(self, resource_group): + response = self.client.dpp_resource_guard_proxy.delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_list(self, resource_group): + response = self.client.dpp_resource_guard_proxy.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_dpp_resource_guard_proxy_unlock_delete(self, resource_group): + response = self.client.dpp_resource_guard_proxy.unlock_delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={"resourceGuardOperationRequests": ["str"], "resourceToBeDeleted": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_dpp_resource_guard_proxy_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_dpp_resource_guard_proxy_operations_async.py new file mode 100644 index 000000000000..160b67822e50 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_dpp_resource_guard_proxy_operations_async.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionDppResourceGuardProxyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_get(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.get( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_create_or_update(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.create_or_update( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "description": "str", + "lastUpdatedTime": "str", + "resourceGuardOperationDetails": [ + {"defaultResourceRequest": "str", "vaultCriticalOperation": "str"} + ], + "resourceGuardResourceId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_delete(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_list(self, resource_group): + response = self.client.dpp_resource_guard_proxy.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_dpp_resource_guard_proxy_unlock_delete(self, resource_group): + response = await self.client.dpp_resource_guard_proxy.unlock_delete( + resource_group_name=resource_group.name, + vault_name="str", + resource_guard_proxy_name="str", + parameters={"resourceGuardOperationRequests": ["str"], "resourceToBeDeleted": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operation_result_operations.py new file mode 100644 index 000000000000..fb759a10b2a8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operation_result_operations.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionExportJobsOperationResultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_export_jobs_operation_result_get(self, resource_group): + response = self.client.export_jobs_operation_result.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operation_result_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operation_result_operations_async.py new file mode 100644 index 000000000000..922dae250452 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operation_result_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionExportJobsOperationResultOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_export_jobs_operation_result_get(self, resource_group): + response = await self.client.export_jobs_operation_result.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operations.py new file mode 100644 index 000000000000..f1e89d05afa0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionExportJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_export_jobs_begin_trigger(self, resource_group): + response = self.client.export_jobs.begin_trigger( + resource_group_name=resource_group.name, + vault_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operations_async.py new file mode 100644 index 000000000000..4072e05a2a96 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_export_jobs_operations_async.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionExportJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_export_jobs_begin_trigger(self, resource_group): + response = await ( + await self.client.export_jobs.begin_trigger( + resource_group_name=resource_group.name, + vault_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_job_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_job_operations.py new file mode 100644 index 000000000000..2693db8c042e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_job_operations.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionFetchCrossRegionRestoreJobOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_cross_region_restore_job_get(self, resource_group): + response = self.client.fetch_cross_region_restore_job.get( + resource_group_name=resource_group.name, + location="str", + parameters={"jobId": "str", "sourceBackupVaultId": "str", "sourceRegion": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_job_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_job_operations_async.py new file mode 100644 index 000000000000..ab2b3c319ff2 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_job_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionFetchCrossRegionRestoreJobOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_cross_region_restore_job_get(self, resource_group): + response = await self.client.fetch_cross_region_restore_job.get( + resource_group_name=resource_group.name, + location="str", + parameters={"jobId": "str", "sourceBackupVaultId": "str", "sourceRegion": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_jobs_operations.py new file mode 100644 index 000000000000..52583fab7079 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_jobs_operations.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionFetchCrossRegionRestoreJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_cross_region_restore_jobs_list(self, resource_group): + response = self.client.fetch_cross_region_restore_jobs.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupVaultId": "str", "sourceRegion": "str"}, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_jobs_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_jobs_operations_async.py new file mode 100644 index 000000000000..4a615f21c8fc --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_cross_region_restore_jobs_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionFetchCrossRegionRestoreJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_cross_region_restore_jobs_list(self, resource_group): + response = self.client.fetch_cross_region_restore_jobs.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupVaultId": "str", "sourceRegion": "str"}, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_secondary_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_secondary_recovery_points_operations.py new file mode 100644 index 000000000000..58aeff7ccc4a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_secondary_recovery_points_operations.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionFetchSecondaryRecoveryPointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fetch_secondary_recovery_points_list(self, resource_group): + response = self.client.fetch_secondary_recovery_points.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_secondary_recovery_points_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_secondary_recovery_points_operations_async.py new file mode 100644 index 000000000000..d1cfc4c31328 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_fetch_secondary_recovery_points_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionFetchSecondaryRecoveryPointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fetch_secondary_recovery_points_list(self, resource_group): + response = self.client.fetch_secondary_recovery_points.list( + resource_group_name=resource_group.name, + location="str", + parameters={"sourceBackupInstanceId": "str", "sourceRegion": "str"}, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_jobs_operations.py new file mode 100644 index 000000000000..3bddac63569e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_jobs_operations.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_jobs_get(self, resource_group): + response = self.client.jobs.get( + resource_group_name=resource_group.name, + vault_name="str", + job_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_jobs_list(self, resource_group): + response = self.client.jobs.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_jobs_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_jobs_operations_async.py new file mode 100644 index 000000000000..b2e536f8e0fd --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_jobs_operations_async.py @@ -0,0 +1,43 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_jobs_get(self, resource_group): + response = await self.client.jobs.get( + resource_group_name=resource_group.name, + vault_name="str", + job_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_jobs_list(self, resource_group): + response = self.client.jobs.list( + resource_group_name=resource_group.name, + vault_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_result_operations.py new file mode 100644 index 000000000000..2a1c5f214541 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_result_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationResultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_result_get(self, resource_group): + response = self.client.operation_result.get( + operation_id="str", + location="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_result_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_result_operations_async.py new file mode 100644 index 000000000000..2fe56265f048 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_result_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationResultOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_result_get(self, resource_group): + response = await self.client.operation_result.get( + operation_id="str", + location="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_backup_vault_context_operations.py new file mode 100644 index 000000000000..c8478da390f0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_backup_vault_context_operations.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationStatusBackupVaultContextOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_status_backup_vault_context_get(self, resource_group): + response = self.client.operation_status_backup_vault_context.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_backup_vault_context_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_backup_vault_context_operations_async.py new file mode 100644 index 000000000000..92815b785b7b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_backup_vault_context_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationStatusBackupVaultContextOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_status_backup_vault_context_get(self, resource_group): + response = await self.client.operation_status_backup_vault_context.get( + resource_group_name=resource_group.name, + vault_name="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_operations.py new file mode 100644 index 000000000000..68eb1b74b50a --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationStatusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_status_get(self, resource_group): + response = self.client.operation_status.get( + location="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_operations_async.py new file mode 100644 index 000000000000..6c995aae4f38 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationStatusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_status_get(self, resource_group): + response = await self.client.operation_status.get( + location="str", + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_resource_group_context_operations.py new file mode 100644 index 000000000000..118de5762206 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_resource_group_context_operations.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationStatusResourceGroupContextOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_status_resource_group_context_get(self, resource_group): + response = self.client.operation_status_resource_group_context.get( + resource_group_name=resource_group.name, + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_resource_group_context_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_resource_group_context_operations_async.py new file mode 100644 index 000000000000..ba6e4db527b1 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_operation_status_resource_group_context_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionOperationStatusResourceGroupContextOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_status_resource_group_context_get(self, resource_group): + response = await self.client.operation_status_resource_group_context.get( + resource_group_name=resource_group.name, + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_recovery_points_operations.py new file mode 100644 index 000000000000..46d4fd297ff2 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_recovery_points_operations.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionRecoveryPointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recovery_points_get(self, resource_group): + response = self.client.recovery_points.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + recovery_point_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_recovery_points_list(self, resource_group): + response = self.client.recovery_points.list( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_recovery_points_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_recovery_points_operations_async.py new file mode 100644 index 000000000000..28e1259ff850 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_recovery_points_operations_async.py @@ -0,0 +1,45 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionRecoveryPointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recovery_points_get(self, resource_group): + response = await self.client.recovery_points.get( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + recovery_point_id="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_recovery_points_list(self, resource_group): + response = self.client.recovery_points.list( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_resource_guards_operations.py new file mode 100644 index 000000000000..ccba9e25ccfe --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_resource_guards_operations.py @@ -0,0 +1,243 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionResourceGuardsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_delete_resource_guard_proxy_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_delete_resource_guard_proxy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_delete_resource_guard_proxy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_resource_guard_proxy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get(self, resource_group): + response = self.client.resource_guards.get( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_put(self, resource_group): + response = self.client.resource_guards.put( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={ + "location": "str", + "eTag": "str", + "id": "str", + "name": "str", + "properties": { + "allowAutoApprovals": bool, + "description": "str", + "provisioningState": "str", + "resourceGuardOperations": [{"requestResourceType": "str", "vaultCriticalOperation": "str"}], + "vaultCriticalOperationExclusionList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_patch(self, resource_group): + response = self.client.resource_guards.patch( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_delete(self, resource_group): + response = self.client.resource_guards.delete( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_resources_in_resource_group(self, resource_group): + response = self.client.resource_guards.get_resources_in_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_resources_in_subscription(self, resource_group): + response = self.client.resource_guards.get_resources_in_subscription() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_disable_soft_delete_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_disable_soft_delete_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_disable_soft_delete_requests_objects(self, resource_group): + response = self.client.resource_guards.get_disable_soft_delete_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_update_protected_item_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_update_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_update_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_update_protection_policy_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_update_protection_policy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_update_protection_policy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protection_policy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_delete_protected_item_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_delete_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_delete_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_default_backup_security_pin_requests_object(self, resource_group): + response = self.client.resource_guards.get_default_backup_security_pin_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_resource_guards_get_backup_security_pin_requests_objects(self, resource_group): + response = self.client.resource_guards.get_backup_security_pin_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_resource_guards_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_resource_guards_operations_async.py new file mode 100644 index 000000000000..030f8a05864e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_resource_guards_operations_async.py @@ -0,0 +1,244 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionResourceGuardsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_delete_resource_guard_proxy_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_delete_resource_guard_proxy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_delete_resource_guard_proxy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_resource_guard_proxy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get(self, resource_group): + response = await self.client.resource_guards.get( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_put(self, resource_group): + response = await self.client.resource_guards.put( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={ + "location": "str", + "eTag": "str", + "id": "str", + "name": "str", + "properties": { + "allowAutoApprovals": bool, + "description": "str", + "provisioningState": "str", + "resourceGuardOperations": [{"requestResourceType": "str", "vaultCriticalOperation": "str"}], + "vaultCriticalOperationExclusionList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_patch(self, resource_group): + response = await self.client.resource_guards.patch( + resource_group_name=resource_group.name, + resource_guards_name="str", + parameters={"tags": {"str": "str"}}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_delete(self, resource_group): + response = await self.client.resource_guards.delete( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_resources_in_resource_group(self, resource_group): + response = self.client.resource_guards.get_resources_in_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_resources_in_subscription(self, resource_group): + response = self.client.resource_guards.get_resources_in_subscription() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_disable_soft_delete_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_disable_soft_delete_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_disable_soft_delete_requests_objects(self, resource_group): + response = self.client.resource_guards.get_disable_soft_delete_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_update_protected_item_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_update_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_update_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_update_protection_policy_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_update_protection_policy_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_update_protection_policy_requests_objects(self, resource_group): + response = self.client.resource_guards.get_update_protection_policy_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_delete_protected_item_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_delete_protected_item_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_delete_protected_item_requests_objects(self, resource_group): + response = self.client.resource_guards.get_delete_protected_item_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_default_backup_security_pin_requests_object(self, resource_group): + response = await self.client.resource_guards.get_default_backup_security_pin_requests_object( + resource_group_name=resource_group.name, + resource_guards_name="str", + request_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_resource_guards_get_backup_security_pin_requests_objects(self, resource_group): + response = self.client.resource_guards.get_backup_security_pin_requests_objects( + resource_group_name=resource_group.name, + resource_guards_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_restorable_time_ranges_operations.py new file mode 100644 index 000000000000..970e49032e33 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_restorable_time_ranges_operations.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionRestorableTimeRangesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restorable_time_ranges_find(self, resource_group): + response = self.client.restorable_time_ranges.find( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"sourceDataStoreType": "str", "endTime": "str", "startTime": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_restorable_time_ranges_operations_async.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_restorable_time_ranges_operations_async.py new file mode 100644 index 000000000000..10bcab30fc5f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_tests/test_data_protection_restorable_time_ranges_operations_async.py @@ -0,0 +1,33 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.dataprotection.aio import DataProtectionClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDataProtectionRestorableTimeRangesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DataProtectionClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restorable_time_ranges_find(self, resource_group): + response = await self.client.restorable_time_ranges.find( + resource_group_name=resource_group.name, + vault_name="str", + backup_instance_name="str", + parameters={"sourceDataStoreType": "str", "endTime": "str", "startTime": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml b/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml index 540da07d41af..13b5f2bd0e69 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml +++ b/sdk/dataprotection/azure-mgmt-dataprotection/pyproject.toml @@ -1,6 +1,86 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-dataprotection" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Dataprotection Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.dataprotection._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-dataprotection" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Data Protection Management" +package_doc_id = "" +is_stable = true +is_arm = true +title = "DataProtectionClient" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/sdk_packaging.toml b/sdk/dataprotection/azure-mgmt-dataprotection/sdk_packaging.toml deleted file mode 100644 index 9448f62fe8c4..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-dataprotection" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Data Protection Management" -package_doc_id = "" -is_stable = true -is_arm = true -title = "DataProtectionClient" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/setup.py b/sdk/dataprotection/azure-mgmt-dataprotection/setup.py deleted file mode 100644 index c26d6e46ea8b..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-dataprotection" -PACKAGE_PPRINT_NAME = "Data Protection Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", - ], - python_requires=">=3.8", -) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/tests/conftest.py b/sdk/dataprotection/azure-mgmt-dataprotection/tests/conftest.py index dcb3a736bf2c..3a899f5bd14a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/tests/conftest.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/tests/conftest.py @@ -34,4 +34,4 @@ def add_sanitizers(test_proxy): add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") \ No newline at end of file + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_async_test.py b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_async_test.py index 6e286a723996..e2a6e34c843d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_async_test.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_async_test.py @@ -14,7 +14,6 @@ AZURE_LOCATION = "eastus" - class TestDataProtectionManagementOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_test.py b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_test.py index 2443f6000688..cd5fb59320e6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_test.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_operations_test.py @@ -13,7 +13,6 @@ AZURE_LOCATION = "eastus" - class TestDataProtectionManagementOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(DataProtectionMgmtClient) diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_async_test.py b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_async_test.py index af2568929d90..b44679e7f346 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_async_test.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_async_test.py @@ -14,7 +14,6 @@ AZURE_LOCATION = "eastus" - class TestDataProtectionManagementResourceGuardsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(DataProtectionMgmtClient, is_async=True) @@ -29,7 +28,6 @@ async def test_list_by_resource_group(self, resource_group): result = [r async for r in response] assert result == [] - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_test.py b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_test.py index 25ecfd231d33..d88a5cc918e6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_test.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/tests/test_dataprotection_management_resourceguards_operations_test.py @@ -13,7 +13,6 @@ AZURE_LOCATION = "eastus" - class TestDataProtectionManagementResourceGuardsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(DataProtectionMgmtClient) @@ -28,7 +27,6 @@ def test_list_by_resource_group(self, resource_group): result = [r for r in response] assert result == [] - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_list_by_subscription(self, resource_group): @@ -37,4 +35,3 @@ def test_list_by_subscription(self, resource_group): ) result = [r for r in response] assert response - \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/tsp-location.yaml b/sdk/dataprotection/azure-mgmt-dataprotection/tsp-location.yaml new file mode 100644 index 000000000000..5fc9c6116527 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/dataprotection/resource-manager/Microsoft.DataProtection/DataProtection +commit: 12850330a0b9e339ded4e707c8312d74a57c2d9f +repo: Azure/azure-rest-api-specs +additionalDirectories: